Advertisement
francydafne

bot

Dec 11th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.85 KB | None | 0 0
  1. print ("Hello, I am francydafne, your bot!")
  2. # code for adding numbers:
  3. command = input ("How can I help? ")
  4. if command == "add" or command == "plus":
  5.     print ("let's add some numbers")
  6.     input1 = input ("Number 1> ")
  7.     input2 = input ("Number 2> ")
  8.     number1 = int(input1)
  9.     number2 = int(input2)
  10.     result = number1 + number2
  11.     output = str(result)
  12.     print (input1 + "+" + input2 + "=" + output)
  13. # code for subtracting numbers:
  14. elif command == "subtract":
  15.     print ("let's subtract some numbers")
  16.     input1 = input ("Number 1> ")
  17.     input2 = input ("Number 2> ")
  18.     number1 = int(input1)
  19.     number2 = int(input2)
  20.     result = number1 - number2
  21.     output = str(result)
  22.     print (input1 + "-" + input2 + "=" + output)
  23. # code for dividing numbers:
  24. elif command == "divide":
  25.     print ("let's divide some numbers")
  26.     input1 = input ("Number 1> ")
  27.     input2 = input ("Number 2> ")
  28.     number1 = int(input1)
  29.     number2 = int(input2)
  30.     result = number1 / number2
  31.     output = str(result)
  32.     print (input1 + "/" + input2 + "=" + output)
  33. # code for multiplying numbers:
  34. elif command == "multiply":
  35.     print ("let's multiply some numbers")
  36.     input1 = input ("Number 1> ")
  37.     input2 = input ("Number 2> ")
  38.     number1 = int(input1)
  39.     number2 = int(input2)
  40.     result = number1 * number2
  41.     output = str(result)
  42.     print (input1 + "*" + input2 + "=" + output)
  43. # code for calculating the area of a square:
  44. elif command == "square area":
  45.     print ("let's calculate the area of a square multiplying its sides")
  46.     input1 = input ("Number 1> ")
  47.     input2 = input ("Number 2> ")
  48.     number1 = int(input1)
  49.     number2 = int(input2)
  50.     result = number1 * number2
  51.     output = str(result)
  52.     print (input1 + "*" + input2 + "=" + output)
  53. # if everything goes wrong....
  54. else:
  55.     print ("sorry, I don't understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement