• Sign Up
• Login
• API
• FAQ
• Tools
• Archive
SHARE
TWEET # Week 2 - 2.14 Challenge suewalters  Apr 26th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
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, or d if you would like to divide. ")
6. input1=input("Number 1> ")
7. input2=input("Number 2> ")
8. number1=int(input1)
9. number2=int(input2)
10. if addsub=="a" or addsub=="A" or addsub=="plus" or addsub=="Plus" or addsub=="add" or addsub=="Add":
11.     result=number1+number2
12.     output=str(result)
13.     print(input1+"+"+input2+"="+output)
14. elif addsub=="s" or addsub=="S" or addsub=="minus" or addsub=="Minus" or addsub=="subtract" or addsub=="Subtract":
15.     result=number1-number2
16.     output=str(result)
17.     print(input1+"-"+input2+"="+output)
18. elif addsub=="m" or addsub=="M" or addsub=="times" or addsub=="Times" or addsub=="multiply" or addsub=="Multiply":
19.     result=number1*number2
20.     output=str(result)
21.     print(input1+"*"+input2+"="+output)
22. elif addsub=="d" or addsub=="D" or ddsub=="divide" or addsub=="Divide":
23.     result=number1/number2
24.     output=str(result)
25.     print(input1+"/"+input2+"="+output)
26. else:
27.     print(addsub+" is not a valid answer. I do not know if I should add, subtract, multiply, or divide. Please Try again.")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top