subject

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()

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:30
Events and conditions that happen within an organization that are somewhat easier to deal with when responding to change are called
Answers: 1
question
Computers and Technology, 22.06.2019 16:00
If a client wants to make minor edits, what should he/she use?
Answers: 3
question
Computers and Technology, 23.06.2019 06:30
You are consulting for a beverage distributor who is interested in determining the benefits it could achieve from implementing new information systems. what will you advise as the first step?
Answers: 1
question
Computers and Technology, 24.06.2019 05:30
If you combine two cells into one, what action are you performing? a.  adding a new row or column      b.  splitting the cells      c.  removing a new row or column      d.  merging the cells
Answers: 2
You know the right answer?
I am creating a simple calculator and when the user enters in two numbers via userinput(), it will a...
Questions
question
Computers and Technology, 22.06.2019 22:30
question
History, 22.06.2019 22:30
question
History, 22.06.2019 22:30
Questions on the website: 13722362