0
Driver's new licence bug
Can someone help me to solver the bug thank you! https://code.sololearn.com/cmRM5OYtpUbI/?ref=app
8 Respostas
+ 3
😄😉😉😉
+ 2
Your "ppl" list isn't a list of names, but a list of characters.
Instead of looking like this
['Alice', 'Bob']
it looks like this
['A', 'l', 'i', 'c', 'e', ' ', 'B', 'o', 'b']
To solve this, change line 4 to
ppl = input().split()
+ 2
#That’s mine, works well and in 6 lines
name = input()
agent = int(input())
client = list(input().split())
client.append(name)
client.sort()
print(int(client.index(name)//agent)*20 + 20)
#hope it helped 😄
+ 1
yep it works,
That was when I just started python and programming so I didn't want to use any function pre-defined
0
are u sure about this because i tried it already and it worked pretty well
0
i didn't write for c in ppl L+=[c]
0
i m counting the indexes of the non space characters of ppl by the variable co and then adding to the list ppl[i:co] with i initiated with 0 and changed to co when i add a string to the list
0
myname = input()
num_agents = int(input())
other_names = list(input().split())
other_names.append(myname)
other_names.sort()
ind_myname = other_names.index(myname)+1
print('20' if ind_myname <=num_agents else (ind_myname-num_agents)*20+20)