+ 1
where I'm doing wrong, new driver's license
Whats wrong? https://code.sololearn.com/c7pn2UNvHQ7J/?ref=app
10 Respostas
+ 4
4/3 = 1.33333
When converted to an int() = 1
range(1) i = 0
c[i*b] = c[0]
c[0] = "Adam"
"Eric" <= "Adam" = False
else block is ran and count is increased
+ 4
No, actually it doesn't.
Try running your code using the sample input given, but use different values for b each time and compare the outputs then walk through your code and ask yourself why you're getting the outputs that you are.
Then reread what I said and see the difference.
+ 3
Try adding the first input name to the list of names and then sorting the list. Then you can get the index of where the first input name is add 1 to it and do the math (round up) to find out which group it will fall into then multiply that number by 20.
+ 3
Eric
3
Adam Caroline Rebecca Frank
If these were the inputs, what should the output be? Then try it with your code.
+ 2
name=input()
agent=int(input())
S=input()
L=S.split(' ')
L.append(name)
L.sort()
number=L.index(name)+1
if number<=agent:
print(20)
if number>agent:
for j in range (1,6,1):
if number -j*agent<=0:
slot=j
break
print(slot*20)
This is my code.
Hope you find this helpful
+ 1
I SOLVING, I DID IT BY TRICK, BUT IT WORKED!
0
ChaoticDawg Doesn't it actually work in this code? I'm doing the same thing you said
0
I did and it works on different entries, it just doesn't work in 1 entry and I can't solve it because I can't see that question
0
I see, thank you, and where did you see this problem?
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)