Advertisement
Ephie

PythonIntro_2-12a

Dec 13th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. print ("Choose what you want to do - add, subtract, multiply or divide.")
  2. select = input (">>")
  3. if select =="add" or select == "subtract" or select == "multiply" or select == "divide":
  4.   print("What's the first number?")
  5.   no1 = input (">>")
  6.   number1 = int(no1)
  7.   print("What's the second number?")
  8.   no2 = input (">>")
  9.   number2 = int(no2)
  10. else:
  11.   print("I don't know this function. Bye.")
  12.  
  13. if select == "add":
  14.   Addresult = number1+number2
  15.   Addoutput = str(Addresult)
  16.   print (no1+"+"+no2+"="+Addoutput)
  17.   print ("bye")
  18. elif select == "subtract":
  19.   Subtractresult = number1-number2
  20.   Subtractoutput = str(Subtractresult)
  21.   print (no1+"-"+no2+"="+Subtractoutput)
  22.   print ("bye")
  23. elif select == "multiply":
  24.   Mulresult = number1*number2
  25.   Muloutput = str(Mulresult)
  26.   print (no1+"*"+no2+"="+Muloutput)
  27.   print ("bye")
  28. elif select == "divide":
  29.   Divresult = number1/number2
  30.   Divoutput = str(Divresult)
  31.   print (no1+"/"+no2+"="+Divoutput)
  32.   print ("bye")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement