Computers and Technology, 06.03.2022 18:50 Monicaamm12983
I am creating a simple calculator and when the user enters in two numbers via userinput(), it will add, sub, multiply, and divide the first number by the second number. All answers will be displayed in the useroutput() function and will be called in the main function. Here is my code that isn't working. What is wrong with it?
def userinput():
n1 = (input("Enter your first number: "))
n2 = (input("Enter your second number: "))
return n1, n2
def useroutput():
print(num1,"+",num2,"=",result)
print(num1,"-",num2,"=",answer)
print(num1,"*",num2,"=",calc)
print(num1,"/",num2,"=",answer2)
def add(a, b):
return (n1 + n2)
def sub(a, b):
return (n1-n2)
def mult(a, b):
product = a * b
return (n1 * n2)
def divide (a, b):
return (n1/n2)
def main():
num1, num2 = userinput()
result= add (num1, num2)
answer = sub (num1,num2)
calc = mult (num1,num2)
answer2 = divide (num1, num2)
main()
Answers: 2
Computers and Technology, 23.06.2019 07:30
What is the penalty for violating section 1201 of title 17 chapter 21 of the us code
Answers: 1
Computers and Technology, 23.06.2019 12:40
Curriculum exam to process a resident's payment, you must click on onesite payments home page. from the a. reports b. my settings o c.transactions o d. rent tab
Answers: 1
Computers and Technology, 24.06.2019 09:10
to change the number of rows and columns displayed by the excel object a. select the object and drag a size handle on the active object. b. deselect the object and drag a size handle of the object. c. deselect the object and drag a row or column divider of the object. d. select the object and drag a row or column divider on the active object.
Answers: 2
Computers and Technology, 24.06.2019 10:00
Which two technologies support the building of single-page applications?
Answers: 2
I am creating a simple calculator and when the user enters in two numbers via userinput(), it will a...
Biology, 05.05.2020 09:50
Mathematics, 05.05.2020 09:50
Mathematics, 05.05.2020 09:50
Biology, 05.05.2020 09:50
Social Studies, 05.05.2020 09:50
History, 05.05.2020 09:50
Mathematics, 05.05.2020 09:50
Mathematics, 05.05.2020 09:50
Social Studies, 05.05.2020 09:50
Mathematics, 05.05.2020 09:50
Mathematics, 05.05.2020 09:50
Mathematics, 05.05.2020 09:50
Mathematics, 05.05.2020 09:50
Physics, 05.05.2020 09:50