Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def do_calculation_with_2_numbers():
- print("lets "+ answer + " your numbers")
- input1=input("enter number 1>")
- input2=input("Enter number2>")
- number1=int(input1)
- number2=int(input2)
- if answer=="substract":
- result=number1-number2
- operator="-"
- elif answer=="add":
- result=number1+number2
- operator="+"
- elif answer=="multiply":
- result=(number1)*(number2)
- operator="*"
- print("Results for "+input1+ operator +input2 + "= "+str(result))
- finished=False
- print("Hello Im gigi your bot")
- print("let's get started for more practice")
- print("How can I help you?")
- while finished==False:
- print("Would you like to make an operation?")
- operation=input("Answer: type Y or YES for YES and type N or NO for NO? >")
- if operation=="NO" or operation=="N":
- print("Bye Bye")
- elif operation=="YES" or operation=="Y":
- answer=input("Do you want to : > ( substract, add, multiply, sum or average) ?>")
- if answer=="substract" or answer=="add" or answer=="multiply":
- do_calculation_with_2_numbers()
- elif answer=="sum" or answer=="average":
- how_many=int(input("How many numbers>"))
- total=0
- Average=0
- for number_count in range(how_many):
- number=input("Enter number "+ str(number_count)+ ":>)")
- total=total+ int(number)
- Average=total/how_many
- if answer=="sum":
- print("Total cost is = " + str(total))
- elif answer=="average":
- print("The average of "+ str(total)+ " by " + str(how_many) + "= "+str(Average))
- else:
- print("Try again. I don't understand")
- elif operation=="bye":
- print("Goodbye!")
- finished=True
- else:
- print("I dont understand '"+ operation + " )'")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement