Hello, would you plz take a look at the question and code below and let me know about the bug? New Driver's License - code coach | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hello, would you plz take a look at the question and code below and let me know about the bug? New Driver's License - code coach

https://code.sololearn.com/cueALt1bdr5w/?ref=app

4th Jun 2022, 8:53 AM
Aref Mowloughi
Aref Mowloughi - avatar
2 Answers
+ 1
In your "for" you should only add 20 minutes when all of the agents are occupied. Right now you are adding 20 minutes for every agent occupied, but they work independently, so after 20 minutes they will all be available. You can do it like this: (...) for i in range(agents): if others[i]== me: break del others[0] if i == agents - 1: t += 20 Also, this could be solved mathematically like this: print(int(others.index(me)/agents)*20 + 20) One advice I can give you on solving these problems in sololearn is to try to know which result are the tests expecting. In this case, I printed 0, 20 and 40 and saw what tests would run successfully. The 5th test that was failing for you expected 40 to be printed. So from there you can more easily understand what your code is doing.
4th Jun 2022, 9:30 AM
João Gonçalves
+ 1
Thank you so much. I appreciate your help.
4th Jun 2022, 9:46 AM
Aref Mowloughi
Aref Mowloughi - avatar