Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hi, I am Zed, your personal bot.")
- command = input("How can I help? ")
- if command == "add" or command == "plus":
- print("lets 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)
- elif command == "subtract" or command == "minus":
- print("lets 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)
- elif command == "multiply":
- print("lets 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)
- elif command == "divide":
- print("lets 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)
- elif command == "Area":
- print("lets calculate the area of a triangle")
- input1 = input("Base > ")
- input2 = input("Hypotenuse > ")
- number1 = int(input1)
- number2 = int(input2)
- result = (number1 * number2) / 2
- output = str(result)
- print("(Base:"+input1 + " * " + "Hypotenuse:"+input2 + ") / 2" + " = " + output)
- elif command == "average" or command == "avg":
- total = 0
- how_many = input("how many numbers? ")
- how_many = int(how_many)
- 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 == "shopping" or command == "shop":
- total = 0
- shopping = []
- how_many = input("how many items of shopping do you have? ")
- how_many = int(how_many)
- for item_number in range(how_many):
- item = input("what is the item " + str(item_number) + " ? ")
- number = input("Enter the cost of " + str(item) + "> ")
- total = total + int(number)
- shopping.append(item)
- print(shopping)
- print("You have " + str(how_many) + " items in your shopping list. Your total is $" + str(total))
- else:
- print("sorry I dont understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement