+ 2

Test case#1 keeps outputing 40 instead of hundred. And code works fine in my IDE. Please why is this

my_name= input() available_agents = int(input ()) other_names= input () _split=other_names.split(',') all_names = _split.append(my_name) _sorted = sorted(_split) _index= _sorted.index(my_name) +1 remainder = _index % available_agents if remainder == 2 : time = 20 * 2 print(time) elif remainder == 1 or remainder ==0: time =20 * ((_index % available_agents) + (_index // available_agents) ) print(time) elif available_agents > _index: print(20)

11th Aug 2020, 7:31 AM
Eleojo Emmanuel Adegbe
Eleojo Emmanuel Adegbe - avatar
2 Answers
+ 4
Eleojo Emmanuel Adegbe _sorted = sorted(_split) Should be _sorted = sorted(all_names)
11th Aug 2020, 1:11 PM
Paul K Sadler
Paul K Sadler - avatar
+ 2
I solved it.. The problem was me splitting with comma "," instead of spaces" "
11th Aug 2020, 1:56 PM
Eleojo Emmanuel Adegbe
Eleojo Emmanuel Adegbe - avatar