go zap去除程序名称
Write a python program that displays a message as follows for a given number:
编写一个python程序,显示给定数字的消息如下:
If it is a multiple of three, display "Zip".
如果是三的倍数,则显示“ Zip” 。
If it is a multiple of five, display "Zap".
如果是5的倍数,则显示“ Zap” 。
If it is a multiple of both three and five, display "Zoom".
如果它是三和五的倍数,则显示“ Zoom” 。
If it does not satisfy any of the above given conditions, display "Invalid".
如果不满足以上任何条件,则显示“ Invalid” 。
Examples:
例子:
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
翻译自: https://www.includehelp.com/python/program-for-zip-zap-and-zoom-game.aspx
go zap去除程序名称