Using python This program should prompt the user to enter an exact multiple of 1
ID: 3785849 • Letter: U
Question
Using python This program should prompt the user to enter an exact multiple of 19 that is greater than 200. Then, the program should analyze the input and display a response to each of the four possible results of the analysis. See sample runs below.
Enter an exact multiple of 19 that is greater than 200 76
No, 76 is a multiple of 19 but it is not greater than 200
>>>
Enter an exact multiple of 19 that is greater than 200 55
55 is not over 200 and also is not a multiple of 19
>>>
Enter an exact multiple of 19 that is greater than 200 222
222 is over 200 but is not a multiple of 19
>>>
Enter an exact multiple of 19 that is greater than 200 380
Good input. 19 divides into 380 exactly 20 times
Explanation / Answer
value = int(input("Enter an exact multiple of 19 that is greater than 200 "))
if value > 200 and value % 19 == 0:
print ("Good input. 19 divides into "+str(value)+" exactly "+str(value / 19)+" times")
elif value > 200 and value % 19 != 0:
print (str(value)+" is over 200 but is not a multiple of 19")
elif value <= 200 and value % 19 != 0:
print (str(value)+" is not over 200 and also is not a multiple of 19")
else:
print ("No, "+str(value)+" is a multiple of 19 but it is not greater than 200")
Output:
sh-4.3$ python3 main.py
Enter an exact multiple of 19 that is greater than 200 380
Good input. 19 divides into 380 exactly 20.0 times
sh-4.3$ python3 main.py
Enter an exact multiple of 19 that is greater than 200 222
222 is over 200 but is not a multiple of 19
sh-4.3$ python3 main.py
Enter an exact multiple of 19 that is greater than 200 55
55 is not over 200 and also is not a multiple of 19
sh-4.3$ python3 main.py
Enter an exact multiple of 19 that is greater than 200 76
No, 76 is a multiple of 19 but it is not greater than 200
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.