where I'm doing wrong, new driver's license | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

where I'm doing wrong, new driver's license

Whats wrong? https://code.sololearn.com/c7pn2UNvHQ7J/?ref=app

10th Nov 2020, 7:11 AM
RAMAZAN AKBAL
RAMAZAN AKBAL - avatar
10 Answers
+ 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
10th Nov 2020, 8:15 AM
ChaoticDawg
ChaoticDawg - avatar
+ 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.
10th Nov 2020, 7:49 AM
ChaoticDawg
ChaoticDawg - avatar
+ 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.
10th Nov 2020, 7:33 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
Eric 3 Adam Caroline Rebecca Frank If these were the inputs, what should the output be? Then try it with your code.
10th Nov 2020, 7:56 AM
ChaoticDawg
ChaoticDawg - avatar
+ 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
11th Nov 2020, 8:04 AM
aditya
aditya - avatar
+ 1
I SOLVING, I DID IT BY TRICK, BUT IT WORKED!
10th Nov 2020, 9:30 AM
RAMAZAN AKBAL
RAMAZAN AKBAL - avatar
0
ChaoticDawg Doesn't it actually work in this code? I'm doing the same thing you said
10th Nov 2020, 7:34 AM
RAMAZAN AKBAL
RAMAZAN AKBAL - avatar
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
10th Nov 2020, 7:51 AM
RAMAZAN AKBAL
RAMAZAN AKBAL - avatar
0
I see, thank you, and where did you see this problem?
10th Nov 2020, 7:57 AM
RAMAZAN AKBAL
RAMAZAN AKBAL - avatar
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)
25th Nov 2021, 10:30 PM
Mas'ud Saleh
Mas'ud Saleh - avatar