2018年1月11日 星期四

Python: Function to test if a number n is multiply by another number m

Python: Function to test if a number n is multiply by another number m

Python Basic: Exercise-147 with Solution

Write a Python function to test if a number n is multiply by another number m. Accept two integers values form the user.
Sample Solution :-
def multiple(m, n):
return True if m % n == 0 else False

print(multiple(20, 5))
print(multiple(7, 2))
============= RESTART: F:/Python_APSC/py-ex-basic-147.py =============
True
False
>>> 

沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...