list - Comparing tuple contents with int in python -


a = [(0, "hello"), (1,"my"), (3, "is"), (2, "name"), (4, "jacob")] 

this example of list, when try this doesn't work:

if time < a[3]:     print ("you did it!") 

the problem can't apparently compare tuple int, want compare first number in tuple. how can this?

this?

if time < a[3][0]: #              ^     print ("you did it!") 

you can index tuple same way did list.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -