Calculator Challange Python Coding Create a simple calculator that takes in TWO numbers from the user and then asks the user to select if they want to ADD, SUBTRACT, MULTIPLY or DIVIDE to get the...


Calculator Challange



Python Coding


Create a simple calculator that takes in TWO numbers from the user and then asks the user to select if they want to ADD, SUBTRACT, MULTIPLY or DIVIDE to get the answer.


I have coded...


print("input whole numbers please, no decimals")
again=""
while again!="N":
first=int(input("What is the first number?"))
last=int(input("What is the last number?"))
#let user pick the operation, assign numbers to the operations
operation=int(input("Would you like to 1) add, 2)subtract, 3)multiply, or 4) divide?"))
if operation==1:
answer=first+last
elif operation==2:
answer=first-last
elif operation ==3:
answer=first*last
elif operation == 4:
answer=first/last
else:
print("You did something wrong, try again.")
print("The answer: %s"%(answer))
again=str(input("Would you like to go again? Y/N")).upper()
same=str(input("Would you like to use the same two numbers? Y/N")).upper()
while same=="Y":
operation = int(input("Would you like to 1) add, 2)subtract, 3)multiply, or 4) divide?"))
if operation == 1:
answer = first + last
elif operation == 2:
answer = first - last
elif operation == 3:
answer = first * last
elif operation == 4:
answer = first / last
else:
print("You did something wrong, try again.")
print("The answer: %s" % (answer))
again = str(input("Would you like to go again? Y/N")).upper()
same = str(input("Would you like to use the same two numbers? Y/N")).upper()


Finish the coding to...


-the numbers inputted and the answers are written into a text file


-output to the text file the full sentence of what operations you are doing.  For example output to the text file :



2 x 3 = 6
Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here