0

What's problem with my code working well still not matching results of last input

me=input() agent=int(input()) names=input() names1=names.split(" ") names1.append(me) names1.sort() aav=names1.index(me) n="" x="" for i in range(0,int(aav)+1,agent ): n=n+str(i) n.split(" ") n=list(n) for j in n: j=int(j)+1 x=j*20 print (x)

13th Nov 2021, 5:02 PM
Yondaime
Yondaime - avatar
4 Respuestas
+ 3
Tharyabha Manek You can solve this just using math, no loops are needed. Add 1 to your index 'aav' and divide by the number of agents (round up if not a whole number) to get the group block you will be in. Then multiply that number by 20.
13th Nov 2021, 5:32 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
ChaoticDawg thanks for your consern :) i will recreate it like you said later currently i want to understand problem in my code edit:it worked thanks:)
14th Nov 2021, 11:20 AM
Yondaime
Yondaime - avatar
13th Nov 2021, 5:27 PM
Simon Sauter
Simon Sauter - avatar
0
Simon Sauter sir you should ignore me i don't think i will follow any rules except legal i like my foolishness so either enjoy me or ignore me
14th Nov 2021, 11:43 AM
Yondaime
Yondaime - avatar