Zip, zap and zoom python program: Here, we are going to execute a python program for zipping, zap and zoom game.
Compose a python program that shows a message as pursues a given number:
- On the off chance that it is a variety of three, show “Zip”.
- On the off chance that it is a variety of five, show “Zap”.
- On the off chance that it is a variety of both three and five, show “Zoom”.
- On the off chance that it doesn’t fulfil any of the above-given conditions, show “Invalid”.
Example:
Input:
Num = 9
Output : Zip
Input:
Num = 10
Output : Zap
Input:
Num = 15
Output : Zoom
Input:
Num = 19
Output: Invalid
Code:
# Define a function for printing particular messages
def display(Num):
if Num % 3 == 0 and Num % 5 == 0 :
print("Zoom")
elif Num % 3 == 0 :
print("Zip")
elif Num % 5 == 0 :
print("Zap")
else :
print("Invalid")
# Main code
if __name__ == "__main__" :
Num = 9
# Function call
display(Num)
Num = 10
display(Num)
Num = 15
display(Num)
Num = 19
display(Num)
Output:
Zip
Zap
Zoom
Invalid