Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.42 KB | None | 0 0
  1. #Asks for command
  2. command = input("How can I help you?>")
  3.  
  4. #If was answered substract
  5. if command == 'substract':
  6.     print("Lets substract some numbers")
  7.     input1 = input("Number 1> ")
  8.     input2 = input("Number 2> ")
  9.     number1 = int(input1)
  10.     number2 = int(input2)
  11.     result = number1 - number2
  12.     output = str(result)
  13.     print(input1 + ' - ' + input2 + ' = ' + output)
  14.  
  15. #If was answered add
  16. elif command == 'add':
  17.     print("lets add some numbers")
  18.     input1 = input("Number 1> ")
  19.     input2 = input("Number 2> ")
  20.     number1 = int(input1)
  21.     number2 = int(input2)
  22.     result = number1 + number2
  23.     output = str(result)
  24.     print(input1 + ' + ' + input2 + ' = ' + output)
  25.  
  26. #If divide was answered
  27. elif command == 'divide':
  28.     print("lets divide some numbers")
  29.     input1 = input("Number 1> ")
  30.     input2 = input("Number 2> ")
  31.     number1 = int(input1)
  32.     number2 = int(input2)
  33.     result = number1 / number2
  34.     output = str(result)
  35.     print(input1 + ' / ' + input2 + ' = ' + output)
  36.  
  37. #If divide was answered
  38. elif command == 'multiply':
  39.     print("lets multiply some numbers")
  40.     input1 = input("Number 1> ")
  41.     input2 = input("Number 2> ")
  42.     number1 = int(input1)
  43.     number2 = int(input2)
  44.     result = number1 * number2
  45.     output = str(result)
  46.     print(input1 + ' x ' + input2 + ' = ' + output)
  47.  
  48. #If a different option have been chosen
  49. else:
  50.     print("sorry I dont understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement