Q:

Counts the number of occurrences of item 50 from a tuple using python programming

belongs to collection: Python Tuple Exercises

0

Counts the number of occurrences of item 50 from a tuple

Given:

tuple1 = (50, 10, 60, 70, 50)

Expected output:

2

All Answers

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

Hint:

Use the count() method of a tuple.

Solution:

tuple1 = (50, 10, 60, 70, 50)
print(tuple1.count(50))

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

total answers (1)

Check if all items in the tuple are the same using... >>
<< Sort a tuple of tuples by 2nd item using python pr...