+ 3
Help on lists !
So when i was coding and used sort() function the program blocked and showed :"can't use '< 'between 'str' and 'list'." I don't understand where the < came from
5 ответов
+ 2
name is a list, and my_name is a string so list have different types can't be sorted because internally it checks which is greater or less to place in order. Instead append my_name to name list and apply sort on name list.
+ 2
You can do also like
list =[*name, my_name ]
You're welcome...
+ 1
Can you show that code?
+ 1
Yes of course!
Here:
my_name = input()
agents = int(input())
name = input().split()
list =[name, my_name ]
list.sort()
yourturn = list.index(my_name)
spam=agents/yourturn
time=(spam*20)+20
print(time)
+ 1
It worked!
Thank you so much for your time i didn't know this until now