- 1

problem with output in sololearns python new drivers license code coach

The program works completely fine when running in pycharm and i gett the correct outputs. But when running it in sololearn it says that there is something wrong with the line of code: names.append(your_name) when your_name = input() and names = input() annyone have the same problem?

24th May 2020, 7:49 PM
Oscar Schyum
Oscar Schyum - avatar
2 odpowiedzi
+ 1
Try this your_name = str(input()) number_agents = int(input()) other_names = str(input()) # listing list_names = other_names.split() list_names.append(your_name) list_names.sort() index = list_names.index(your_name ) + 1 if number_agents >= index: print(20) else: d = index - number_agents out = 20 + d*20 print(out) Happy coding 😊 Keep coding 🙏
24th May 2020, 9:07 PM
Alfred Juma
Alfred Juma - avatar
0
append method is list function. There in your code, inputs are string only... So you can't use there..
24th May 2020, 7:54 PM
Jayakrishna 🇮🇳