0

How to solve "New driver's license" problem without using math.ceil, rather using this method below?

I try another method, 1. First I take input() from user and 2. define function that add user_name in other_4 list, 3. and .sort(), 4. then cut list in chunks by given "agendt_num" 5. Then order existing chunk number that where "me" object exist. 6. Lastly, print(existing_chunk_number * 20)

16th May 2023, 11:17 PM
Altaibaatar Enkhbat
Altaibaatar Enkhbat - avatar
10 Respuestas
+ 5
Vibhor , > it is not seen as a helpful behavior when we are going to post a ready-made code, as long as the op has not shown his attempt here. > it is more helpful to give hints and tips, so that the op has a chance to find a solution by himself.
17th May 2023, 1:52 PM
Lothar
Lothar - avatar
+ 4
Here is the code try this: According to you it is the most effective method to solve this problem. https://code.sololearn.com/cE0BVM77prhC/?ref=app
17th May 2023, 4:26 AM
Vibhor
Vibhor - avatar
+ 4
Orin Cook Because agent will solve the problem of person by their name, that's why it is sorted according to dictionary in alphabetical order. It's in the question.
17th May 2023, 4:31 AM
Vibhor
Vibhor - avatar
+ 4
Orin Cook Altaibaatar Enkhbat Inside the function, the other_names string is split into a list called names, and your_name is appended to this list. The names list is then sorted in alphabetical order. The variable position is assigned the index of your_name in the sorted names list and that's how it works.
17th May 2023, 4:34 AM
Vibhor
Vibhor - avatar
+ 4
Orin Cook No worries, happens to the best of us! It's like finding Waldo in a sea of emojis. 😂
17th May 2023, 4:44 AM
Vibhor
Vibhor - avatar
+ 2
Ah, so it is, missed that on my first reading somehow.
17th May 2023, 4:37 AM
Orin Cook
Orin Cook - avatar
+ 2
Yes I got you Lothar ,actually i have a practice of watching solution early by just practicing 2 3 times and understanding the code and algorithm after that, it doesn't waste my time much on a single problem and I can cover more effectively. That's why i send others too.I will take care of that next time. Thanks for suggestion.
17th May 2023, 2:18 PM
Vibhor
Vibhor - avatar
+ 1
I don't understand what you're trying to do here, especially why you'd sort.
17th May 2023, 12:36 AM
Orin Cook
Orin Cook - avatar
+ 1
Altaibaatar Enkhbat I think that math.ceil would not be useful in the problem solution. Since you asked for an alternative approach, here is a way to solve it without sorting: 1. Take inputs from user 2. Split names into a list 3. Loop through the list and count how many names are alphabetically less than or equal to "my" name. (No sorting.) 4. Calculate wait time
17th May 2023, 9:11 PM
Brian
Brian - avatar
0
You do not need use math.ceil method in this simple task("new driver's license "). If you show code, so we can help you with that
17th May 2023, 3:14 AM
Smith Welder
Smith Welder - avatar