+ 2
Helpme on the sololearn challenge about New Driver License
i have my code here, and it works on 2nd 3rd and 5th case , but not the rest, please kinda fix this myname = input() agent = int(input()) other = list(input().split()) other.append(myname) other.sort() people = len(other) process = people/agent + .5 process = int(round(process)) time = 0 for i in range(0,people,process): if myname in other[i:i+process]: time += 20 break else : time += 20 print(time)
2 odpowiedzi
+ 2
Hi Farrel Baskara
The first part of your code seems correct. Not sure what the `process` is meant to represent though. I'm guessing it's a stepping value of some sort, since you have it in the for loop. If that's the case, then you don't need to calculate it - you can just use `agent`.
So if I understand your loop logic correctly, it'll work if you just use `agent` in place of `process`. You can also just use one update of `time` in the beginning of the loop, since it executes in both case of the if-else. Like this:
for i in range(0, people, agent):
time += 20
if myname in other[i:i+agent]:
break
Hope this helps.
0
thankyou so much! helps a lot