Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Calculate_something():
- 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":
- input1=input("enter number 1>")
- input2=input("Enter number2>")
- number1=int(input1)
- number2=int(input2)
- print("lets "+ answer + " your numbers")
- if answer=="substract":
- substraction=number1-number2
- print("Results for "+input1+ "-"+input2 + "= "+ str(substraction))
- elif answer=="add":
- addition=number1+number2
- print("Result for "+input1+ "+"+input2 + "= "+str(addition))
- elif answer=="multiply":
- multiplication=(number1)*(number2)
- print("Results for "+input1+ "*"+input2 + "= "+str(multiplication))
- 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 + " )'")
- Calculate_something()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement