Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 3 Program: Wite code that asks the user for two numbers in a loop. For every two numbers that the user enters, you want
Python 3 Program:
Wite code that asks the user for two numbers in a loop. For every two numbers that the user enters, you want to show their multiplication. You allow the user to stop the program when he enters zero for any of the numbers. For some reason, if the numbers are dividers of each other, that is an error and the program also stops, but with an error message. Finally, you will not process numbers higher than 1000 or smaller than zero, but that is not an error; you just want to allow the user to enter new numbers.
examples
% python3 ch07_08.py enter number 1: 2 enter number 2: 3 2.0 times 3.0 is: 6.0 enter number 1: 2 enter number 2: 0 % python3 ch07_08.py enter number 1: 3 enter number 2: 4 3.0 times 4.0 is: 12.0 enter number 1: 2 enter number 2: 4 error: they divide each other % python3 ch07_08.py enter number 1: 0 % python3 ch07_08.py enter number 1: 1001 enter number 1: 1000 enter number 2: -2 enter number 2: 0 % python3 ch07_08.py enter number 1: 999 enter number 2: -1 enter number 2: 1 error: they divide each other % python3 ch07_08.py enter number 1: 1001 enter number 1: 999 enter number 2: -2 enter number 2: 4 999.0 times 4.0 is: 3996.0 enter number 1: % python3 ch07_08.py enter number 1: 2 enter number 2: 3 2.0 times 3.0 is: 6.0 enter number 1: 4 enter number 2: 5 4.0 times 5.0 is: 20.0 enter number 1: 6 enter number 2: 7 6.0 times 7.0 is: 42.0 enter number 1: 8 enter number 2: 9 8.0 times 9.0 is: 72.0 enter number 1: 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started