Math Interpreter
In this assignment, students will write a Python program that performs basic arithmetic operations such as addition, subtraction, multiplication, division, modulus, and exponentiation. For this assignment, you will generate random numbers.
Write a program called Math_Interpreter.py
, that generates random numbers between 1 and 100.
Read more about Python Random numbers
. Refer to zyBooks (2.10)
Hint: Use random.randint(min, max).
The random function can be used for random sampling in data analysis, cryptographic
applications such as generating encryption keys and tokens for authentication, Game development, and Artificial Intelligence and Machine Learning.
Import the random module to generate random numbers between 1 and 100 and assign
them to variables num1
and num2
.
Perform the following basic arithmetic operations on the two random numbers generated:
Addition (+)
Subtraction (-)
Multiplication (*)
Division (/)
Modulus (%)
Exponentiation (**) Format the output and display the result.
In a print statement, display what is the difference between the Division(/) and modulus (%) operator. Your submission must include tested or sample output of your code.
©
prayappa