Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print ("Hello, I am francydafne, your bot!")
- # code for adding numbers:
- command = input ("How can I help? ")
- if command == "add" or command == "plus":
- print ("let's add some numbers")
- input1 = input ("Number 1> ")
- input2 = input ("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number2
- output = str(result)
- print (input1 + "+" + input2 + "=" + output)
- # code for subtracting numbers:
- elif command == "subtract":
- print ("let's subtract some numbers")
- input1 = input ("Number 1> ")
- input2 = input ("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 - number2
- output = str(result)
- print (input1 + "-" + input2 + "=" + output)
- # code for dividing numbers:
- elif command == "divide":
- print ("let's divide some numbers")
- input1 = input ("Number 1> ")
- input2 = input ("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 / number2
- output = str(result)
- print (input1 + "/" + input2 + "=" + output)
- # code for multiplying numbers:
- elif command == "multiply":
- print ("let's multiply some numbers")
- input1 = input ("Number 1> ")
- input2 = input ("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 * number2
- output = str(result)
- print (input1 + "*" + input2 + "=" + output)
- # code for calculating the area of a square:
- elif command == "square area":
- print ("let's calculate the area of a square multiplying its sides")
- input1 = input ("Number 1> ")
- input2 = input ("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 * number2
- output = str(result)
- print (input1 + "*" + input2 + "=" + output)
- # if everything goes wrong....
- else:
- print ("sorry, I don't understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement