Write a function NumRepeats(num1,num2,num3) that takes 3 integers as arguments, and returns the number of items that are repeated.
Example:
NumRepeats( 5, 9, 4) will return 0
NumRepeats( 5, 9, 5) will return 1
NumRepeats( 5, 5, 5) will return 2
def NumRepeats(num1, num2, num3):
if num1 == num2 and num2 == num3:
return 2
if num1 == num2 or num2 == num3 or num1 == num3:
return 1
return 0
Comments
Leave a comment