Created
December 13, 2017 04:34
-
-
Save mycarta/c85a45adc31700f98b4081d2531ee766 to your computer and use it in GitHub Desktop.
PersonalSeagreenGalapagosmockingbird created by anonymous - https://repl.it/repls/PersonalSeagreenGalapagosmockingbird
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
print ('Hello, I am a talking calculator and my name is Jester.') | |
name = raw_input('What is your name? ') | |
print ('Hello ' + name.capitalize() + ', nice to meet you!') | |
while True: | |
operation = raw_input(name.capitalize() + | |
', would you like to subtract or add? (enter "q" to quit)') | |
if operation.lower() =='q': | |
print('Goodbye ' + name.capitalize()) | |
break | |
else: | |
print ('OK, ready to ' + operation + ' for you.') | |
num1, num2 = [int(x) for x in raw_input('Can I have the two numbers to ' + operation + ' please?').split()] | |
if (name.lower() == 'rebecca'): | |
num3 = 0 | |
rnd1 = randint(1,3) | |
rnd2 = randint(1,5) | |
if rnd1 == 3: | |
num3 = rnd2 | |
num3 = 0 | |
if operation.lower() == 'add': | |
result = num1 + num2 + num3 | |
elif operation.lower() == 'subtract': | |
result = (max(num1, num2) - min(num1, num2)) - num3 | |
print result | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment