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 01:00
Duplicating objects creates copies that a. move differently than the original object b. erase the original object c. look and act like the original object d. add events to a game
Answers: 1
question
Computers and Technology, 22.06.2019 01:00
Search the web for two examples of digital art that you like. the examples must be from different mediums (example: one digital photo and one computer animation not two computer animations). compose an essay for each example you choose about why the piece appeals to you, and identify the medium used.
Answers: 1
question
Computers and Technology, 22.06.2019 10:30
You are almost finished updating a web site. as part of the update, you have converted all pages from html 4.0 to html5. the project is currently on schedule. however, your project manager has been asked by the marketing team manager to justify a day of time spent validating the site's html5 pages. the marketing team manager does not have technical knowledge of the internet or the web. which is the most appropriate explanation to provide to the marketing team manager?
Answers: 1
question
Computers and Technology, 23.06.2019 10:30
Would a ps4 wired controller work on an xbox one
Answers: 1
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, 08.01.2021 01:00
question
Mathematics, 08.01.2021 01:00
question
Mathematics, 08.01.2021 01:00
question
Mathematics, 08.01.2021 01:00
question
English, 08.01.2021 01:00
Questions on the website: 13722363