Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print ("Hello.")
- print ("I am a calculator.")
- users_name = input("What might be your name? > ")
- print ()
- print ("A pleasure to meet you " + users_name + "!")
- command = input ("Would you like to add(+), subtract(-), multiply(x), or divide(/)? > ")
- print ()
- if command == "add" or command == "+":
- print ("Addition it is!")
- input1= input("1st number > ")
- input2= input("2nd number > ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number2
- answer = str(result)
- print (input1 + " + " + input2 + " = " + answer)
- print ("Impresive, I know")
- elif command == "subtract" or command == "-":
- print ("Subraction here we come!")
- input1= input("1st number > ")
- input2= input("2nd number > ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 - number2
- answer = str(result)
- print (input1 + " - " + input2 + " = " + answer)
- print ("Don't act like you're not impressed!")
- elif command == "multiply" or command == "x":
- print ("Multiplication is my favorite!")
- input1= input("1st number > ")
- input2= input("2nd number > ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 * number2
- answer = str(result)
- print (input1 + " x " + input2 + " = " + answer)
- print ("Sometimes I truly amaze myself!")
- elif command == "divide" or command == "/":
- print ("Ugh, division...")
- input1= input("1st number > ")
- input2= input("2nd number > ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 / number2
- answer = str(result)
- print (input1 + " / " + input2 + " = " + answer)
- print ("Yikes, I'm glad that's over with.")
- else:
- print ("That just doesn't make any sense. Please try your luck next time.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement