Answer to Question #293746 in Python for hsoxx01

Question #293746

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


1
Expert's answer
2022-02-03T16:35:12-0500
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS