Advertisement
GCK

GCK/add_subtract_multiply_average Test

GCK
Sep 13th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.60 KB | None | 0 0
  1. print("Hello Im gigi your bot")
  2. print("let's get started for more practice")
  3. print("How can I help you?, Would you like to make an operation?")
  4. operation=input("Answer: type  Y or YES for YES and type N or NO for NO? >")
  5.  
  6. if operation=="NO" or operation=="N":
  7.     print("Bye Bye")
  8. elif operation=="YES" or operation=="Y":
  9.     answer=input("Do you want to : > ( substract, add, multiply or average) ?>")
  10.     if answer=="substract" or answer=="add" or answer=="multiply":
  11.         input1=input("enter number 1>")
  12.         input2=input("Enter number2>")
  13.         number1=int(input1)
  14.         number2=int(input2)
  15.         print("lets "+ answer + " your numbers")
  16.         if answer=="substract":
  17.             substraction=number1-number2
  18.             print("Results for "+input1+ "-"+input2 + "= "+ str(substraction))
  19.         elif answer=="add":
  20.             addition=number1+number2
  21.             print("Result for "+input1+ "+"+input2 + "= "+str(addition))
  22.         elif answer=="multiply":
  23.             multiplication=(number1)*(number2)
  24.             print("Results for "+input1+ "*"+input2 + "= "+str(multiplication))
  25.     elif answer=="average":
  26.         how_many=int(input("How many numbers>"))
  27.         total=0
  28.         Average=0
  29.         for number_count in range(how_many):
  30.             number=input("Enter number "+ str(number_count)+ ":>)")
  31.             total=total+ int(number)
  32.         Average=total/how_many
  33.         print("The average of "+ str(total)+ " by " + str(how_many) + "= "+str(Average))
  34.     else:
  35.         print("Try again. I don't understand")
  36. else:
  37.     print("I dont understand '"+ operation + " )'")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement