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, 23.06.2019 21:00
Alcohol’s affects on the cornea and lens of the eye make it more difficult
Answers: 1
question
Computers and Technology, 24.06.2019 00:30
The best definition of an idiom is a. a word or phrase that describes a noun b. a word or phrase describing a verb c. a phrase containing figurative language in which the word expresses a different idea from its exact meaning d. a phrase that compares two unlike objects or ideas
Answers: 2
question
Computers and Technology, 24.06.2019 05:30
How do i get rid of my member ship for
Answers: 2
question
Computers and Technology, 24.06.2019 17:40
Create a file called favorite_foods, and list your favorite foods, entering five or six or more. press enter after each favorite food so it appears on its own line (make certain you also press enter after the final food item). after the file is created, add two more foods you like that are not on the list (press enter after the final food item). view the list of foods to make certain the two items you added appear at the end of the list
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
Mathematics, 27.12.2019 04:31
question
Mathematics, 27.12.2019 04:31
Questions on the website: 13722362