Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hello, I'm Lucy. I'm your personal maths bot.")
- users_name=input("What's your name? ")
- if users_name=="Lucy" or users_name==("lucy"):
- print("Wow! Just like me.")
- print("Hello "+users_name+", and welcome!")
- print("Let's make a start.")
- input_1=input("Give me a number. ")
- print("Ooh, that's one of my favourites! ")
- input_2=input("Give me another number. ")
- print("What would you like me to do with these numbers?")
- action_1=input("I can add, subtract, divide or multiply >")
- num_1=int(input_1)
- num_2=int(input_2)
- if action_1=="add" or action_1=="ADD" or action_1=="Add" or action_1=="+":
- print("The total is "+(input_1+input_2))
- print("No wait. That's not right.")
- sum_1=num_1+num_2
- print(sum_1)
- print("That's better.")
- result=str(sum_1)
- print(input_1 + " + " +input_2 + " = " + result)
- print("I'm pretty sure that's right.")
- print("I hope that's been useful for you, "+ users_name)
- elif action_1=="multiply" or action_1=="MULTIPLY" or action_1=="Multiply" or action_1=="*":
- sum_2=num_1*num_2
- result_2=str(sum_2)
- sum_3=(num_1*num_2)+1234567
- result_3=str(sum_3)
- print("If I multiply them together, it's "+result_2)
- print("If I multiply them together and add 1234567 it's "+result_3)
- if sum_3>1234999 and sum_3<2000000:
- print("That's a really big number. I'm tired now.")
- elif sum_3>1999999:
- print("That's huge! Don't make me do that again.")
- else:
- print("Phew. That one wasn't too tricky.")
- print("I hope that's been useful for you, "+ users_name)
- elif action_1=="subtract" or action_1=="SUBTRACT" or action_1=="Subtract" or action_1=="-":
- sum_4=(num_1-num_2)
- result_4=str(sum_4)
- print(input_1 + "-" + input_2 + "=" + result_4)
- print("I hope that's been useful for you, "+ users_name)
- elif action_1=="divide" or action_1=="DIVIDE" or action_1=="Divide" or action_1=="/":
- print("Do I have to? Division is tricky.")
- confirm_1=input("Type yes or no >")
- if confirm_1=="yes or no":
- print("Ha ha. Very funny.")
- elif confirm_1=="no":
- print("Great! Thank you.")
- elif confirm_1=="yes":
- sum_5=float(num_1)/float(num_2)
- result_5=str(sum_5)
- print("Okay then, if I must.")
- print(input_1 + " divided by " + input_2 +" = " +result_5)
- print("I hope that's been useful for you, "+ users_name)
- print("I'm confused. I don't know what that means.")
- else:
- print("I'm confused. I don't know what that means.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement