0
New Driving License (Test case 5 Failed )
#Test case Failed !! NEED HELP!! name = str(input()) num_agents = int(input()) people = list(input().split(" ")) people.append(name) new_list = sorted(people) if num_agents >= int(new_list.index(name)): print(20) elif num_agents == 1: print(20*(int(new_list.index(name)+1))) else: if num_agents == 2: if 2 <= new_list.index(name) <= 3: print(40) else: print(60) else: print(40)
3 Antworten
+ 1
first if statement starts indexing from 0.
Use:if num_agents >= int(new_list.index(name)+1)
+ 1
Justus i forgot to add +1 when using index.. Thanku you
0
What happens in your code, then num_agents is 3 or 4?