vendredi 25 janvier 2019

Compare Only First Number Of A Tuple (Python)

I am looking for a way to only compare the first number of a 3 number tuple. For example let's say I have this tuple: a = (255, 100, 200) and this tuple b = (255, 10, 20). If I were to check if they were equal using:

if a == b:
    print("equal")
else:
    print("unequal")

Then I would obviously get unequal since they are not the same. But the first number is the same, how would I be able to compare only the first number so that I would get equal printed using these tuples?

Aucun commentaire:

Enregistrer un commentaire