Problem Set2_ Math Interpreter

docx

School

Arizona State University *

*We aren’t endorsed by this school

Course

6

Subject

Mathematics

Date

Apr 3, 2024

Type

docx

Pages

2

Uploaded by AmbassadorTeam8448

Report
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
Sample output: Generated Numbers: 48 and 3 Addition: 48 + 3 = 51 Subtraction: 48 - 3 = 45 Division: 48 / 3 = 16.0 Multiplication: 48 * 3 = 144 Modulus: 48 % 3 = 0 Exponent: 48 ** 3 = 110592 © prayappa
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help