I would isolate the last element of a tuple like
a = (3,5,5)
last = a[-1]
but the problem is that i have a pice ok code like this
if var == last:
do something
and it takes the first 5 and not the second, how can i do to take the last one?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What you are trying to do is impossible. Those two fives are exactly the same.
However, when iterating over the tuple you can check if you reached the last element like this:
Demo: