Advertisement
suewalters

Week 3 - 3.12

May 1st, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. print("Hi, I am the bot that Sue created.")
  2. print("Let's get started.")
  3. users_name=input("What is your name? ")
  4. print("Welcome "+users_name)
  5. addsub=input("Please press a if you would like to add, s if you would like to subtract, m if you would like to multiply, d if you would like to divide. or v if you would like to calculate the average >")
  6. if addsub=="v" or addsub=="V" or addsub=="mean" or addsub=="Mean"or addsub=="average" or addsub=="Average":
  7. how_many=input("How Many Numbers >")
  8. how_many=int(how_many)
  9. total=0
  10. for number_count in range(how_many):
  11. number=input("Enter number "+str(number_count)+"> ")
  12. total = total + int(number)
  13. result=total/how_many
  14. print("The average ="+str(result))
  15. else:
  16. input1=input("Number 1> ")
  17. input2=input("Number 2> ")
  18. number1=int(input1)
  19. number2=int(input2)
  20. if addsub=="a" or addsub=="A" or addsub=="plus" or addsub=="Plus" or addsub=="add" or addsub=="Add":
  21. result=number1+number2
  22. output=str(result)
  23. print(input1+"+"+input2+"="+output)
  24. elif addsub=="s" or addsub=="S" or addsub=="minus" or addsub=="Minus" or addsub=="subtract" or addsub=="Subtract":
  25. result=number1-number2
  26. output=str(result)
  27. print(input1+"-"+input2+"="+output)
  28. elif addsub=="m" or addsub=="M" or addsub=="times" or addsub=="Times" or addsub=="multiply" or addsub=="Multiply":
  29. result=number1*number2
  30. output=str(result)
  31. print(input1+"*"+input2+"="+output)
  32. elif addsub=="d" or addsub=="D" or addsub=="divide" or addsub=="Divide":
  33. result=number1/number2
  34. output=str(result)
  35. print(input1+"/"+input2+"="+output)
  36. else:
  37. print(addsub+" is not a valid answer. I do not know if I should add, subtract, multiply, divide, or take an average. Please Try again.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement