Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hi, i am your personal bot. lets get started")
- user_name = input("What is your name? ")
- print("Welcome " + user_name)
- command = input("How can I help? ")
- if command == "add":
- print("Lets add some numbers")
- input1 = input("number 1> ")
- input2 = input("number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number2
- print(input1 + " + " + input2 + " = " + str(result))
- elif command == "subtract":
- print("Lets subtract some numbers")
- input1 = input("number 1> ")
- input2 = input("number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 - number2
- print(input1 + " - " + input2 + " = " + str(result))
- 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 == "shopping":
- shopping = []
- price_total = 0
- how_many2 = input("How many items do you need? ")
- how_many2 = int(how_many2)
- for item_numbers in range(how_many2):
- item = input("What is the item name " + str(item_numbers) + " ?")
- shopping.append(item)
- cost = input("What is the price for " + str(item) + "? ")
- shopping.append(cost)
- price_total = price_total + float(cost)
- discount = input("Enter the discount? ")
- discount_real = float(int(discount)/100)
- discount_final = float(price_total * discount_real)
- price_final = float(discount_final)
- print(shopping)
- print("The total price of the items before discount is " + str(price_total))
- print("The total price of the items after discount is " + str(price_final))
- else:
- print("Sorry, i don't understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement