Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def do_calculation():
- print("lets " + command + " some numbers")
- input1 = input("Number 1>")
- input2 = input("Number 2>")
- number1 = int(input1)
- number2 = int(input2)
- if command == "add":
- result = number1 + number2
- elif command == "subtract":
- result = number1 - number2
- output = str(result)
- if command == "add":
- print(input1 + " + " + input2 + " = " + output)
- elif command == "subtract":
- print(input1 + " + " + input2 + " = " + output)
- finished = False
- while finished == False:
- print("Him I am Mr Biddle, your personal bot. ")
- command = input("How can I help?")
- if command =="add":
- do_calculation()
- if command =="subtract":
- do_calculation()
- 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 == "area":
- print("lets find out the area of this room")
- input1 = input("length> ")
- input2 = input("width> ")
- 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=="shopping":
- shopping=[]
- how_many=input("How many items do you have in your shopping list")
- how_many=int(how_many)
- for item_number in range(how_many):
- item=input("what is item number " + str(item_number) + "?")
- shopping.append(item)
- for item in shopping:
- print(item)
- total=len(shopping)
- print("you have "+str(total)+" items in your shopping list")
- elif command == "bye":
- finished = True
- else:
- print("sorry I dont have a scooby")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement