A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

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

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

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)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now