elena_gancedo

Sume_Subtract_Multiply_Divide

Jun 23rd, 2019
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.62 KB | None | 0 0
  1. print("Hi, I am Eley, your personal bot.")
  2. command = input("How can I help? ")
  3. if command == "add" or command == "plus":
  4.     print("lets add some numbers")
  5.     input1 = input("Number 1> ")
  6.     input2 = input("Number 2> ")
  7.     number1 = int(input1)
  8.     number2 = int(input2)
  9.     result = number1 + number2
  10.     output = str(result)
  11.     print(input1 + " + " + input2 + " = " + output)
  12. else:
  13.     print("Sorry your entry is wrong.")
  14. command1 = input("Let's do a subtraction with the result of the sum: ")
  15. if command1 == "let's do it" or command1 == "all right":
  16.     print("lets subract some numbers")
  17.     input3 = input("Number 3> ")
  18.     number3 = int(input3)
  19.     number4 = int(output)
  20.     print(number4)
  21.     result1 = number3 - number4
  22.     output1 = str(result1)
  23.     print(input3 + " - " + output + " = " + output1)
  24. else:
  25.     print("Sorry your entry is wrong, operations are not possible.")
  26. command2 = input("Let's continue with other operations such as multiply / divide: ")
  27. if command2 == "multiply":
  28.     print("Let's multiply the result of the subtraction by a given number")
  29.     input4 = input("Number 4> ")
  30.     number5 = int(input4)
  31.     number6 = int(output1)
  32.     result2 = number5 * number6
  33.     output2 = str(result2)
  34.     print(input4 + " * " + output1 + " = " + output2)
  35. elif command2 == "divide":
  36.     print("Let's divide the result of the subtraction by a given number")
  37.     input4 = input("Number 4> ")
  38.     number5 = int(input4)
  39.     number6 = int(output1)
  40.     result2 = number6 / number5
  41.     output2 = str(result2)
  42.     print(output1 + " / " + input4 + " = " + output2)
  43. else:
  44.     print("Sorry I dont understand.")
Add Comment
Please, Sign In to add comment