Write a Python program that displays a message as follows for a given number:
If it is a multiple of three, display "Zip" If it is a multiple of five, display "Zap". If it is a multiple of both three and five, display "Zoom". If it does not satisfy any of the above given conditions, display "Invalid".
def display(num):
message="Zip, Zap, Zoom"
if(num%3==0):
print("Zip")
elif(num%5==0):
print("Zap")
elif((num%3==0) and (num%5==0)):
print("Zoom")
else:
print("Invalid Number")
return message
message=display(15)
print(message)
I expect the output of 15 to be Zoom, but the actual output is Zip.
Aucun commentaire:
Enregistrer un commentaire