Recall your simple calculator program, add another function to it called result. This function called result should accept four parameters (operation, num1, num2, output) and should print out the output of each arithmetic operation. The output could look like this: "The result of ADDING 10 and 20 is 30" Hint 1: call the result function right after calling the respective operation. Example: x = ADD(n, m) result ("ADDING", n, m, x) Hint 2: Placeholders and string.format() function could be very useful here.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

THIS IS THE SIMPLE CALCULATOR PROGRAM

 

def ADD (num1,num2):
sum=num1+num2
print(sum)

def SUBT (num1,num2):
res=num1-num2
print(res)

def MULT (num1,num2):
product=num1*num2
print(product)

def DIV (num1,num2):
results=num1/num2
print(results)

def POW (num1,num2):
power=num1**num2
print(power)

def MOD (num1,num2):
modulo=num1%num2
print(modulo)

def INT (num1,num2):
integer=int(num1/num2)
print(integer)

def PERCENT (num1,num2):
percentage=(num1/num2)*100
print(percentage)

A=int(input("Enter the first number: "))
B=int(input("Enter the second number: "))


ADD(A,B)
SUBT(A,B)
MULT(A,B)
DIV(A,B)
POW(A,B)
MOD(A,B)
INT(A,B)
PERCENT(A,B)

 

Recall your simple calculator program,
add another function to it called result.
This function called result should accept
four parameters (operation, num1,
num2, output) and should print out the
output of each arithmetic operation.
The output could look like this: "The
result of ADDING 10 and 20 is 30"
Hint 1: call the result function right after
calling the respective operation. Example:
x = ADD(n, m)
result ("ADDING", n, m, x)
Hint 2: Placeholders and string.format()
function could be very useful here.
Transcribed Image Text:Recall your simple calculator program, add another function to it called result. This function called result should accept four parameters (operation, num1, num2, output) and should print out the output of each arithmetic operation. The output could look like this: "The result of ADDING 10 and 20 is 30" Hint 1: call the result function right after calling the respective operation. Example: x = ADD(n, m) result ("ADDING", n, m, x) Hint 2: Placeholders and string.format() function could be very useful here.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education