Q:

Check if all items in the tuple are the same using python programming

belongs to collection: Python Tuple Exercises

0

Check if all items in the tuple are the same

tuple1 = (45, 45, 45, 45)

Expected output:

True

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

def check(t):
    return all(i == t[0] for i in t)

tuple1 = (45, 45, 45, 45)
print(check(tuple1))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

<< Counts the number of occurrences of item 50 from a...