+ 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
2 Antworten
+ 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.
+ 1
Thank you so much. I appreciate your help.