Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print ("Hi, I am Marvin, your personal bot. ")
- #ask the user to enter their name
- name =input ("what is your name? ")
- #print a message including the name
- print ("Hello " + name)
- command=input("How can I help? ")
- if command == "add" or command == "plus":
- print ("Let's add some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number2
- output = str(result)
- print(input1 + " + " + input2 + " = " + output)
- elif command == "subtract" or command == "take away":
- print ("Let's subtract some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 - number2
- output = str(result)
- print(input1 + " - " + input2 + " = " + output)
- #we need to include other commands
- elif command == "multiply" or command == "times":
- print ("Let's Multiply some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 * number2
- output = str(result)
- print(input1 + " - " + input2 + " = " + output)
- elif command == "divide" or command == "share":
- print ("Let's Divide some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 / number2
- output = str(result)
- print(input1 + " / " + input2 + " = " + output)
- elif command == "average":
- how_many = input ("How many numbers> ")
- how_many = int (how_many)
- total =0
- for number_count in range (how_many):
- number = input ("Enter number " +str (number_count) + "> ")
- total = total + int (number)
- result = total/how_many
- print ("the average = " + str(result))
- elif command == "Add Vat":
- print ("Lets add VAT to an item")
- input1 = input ("How much did the item cost? >£")
- input2 = input ("What is the current rate of VAT? >" "%")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number1 / 100 * number2
- print ("You will pay = £ " +str (result) + " icluding VAT")
- else:
- print ("Sorry I dont understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement