-
-
Save codecademydev/3f29ff2ea2537c38ff7219adcc0b32f5 to your computer and use it in GitHub Desktop.
Codecademy export
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
import random | |
name = "Earl" | |
question = "Will i win the lottery?" | |
answer = "" | |
random_number = random.randint(1, 10) | |
print(random_number) | |
if random_number == 1: | |
answer = "Yes - definittely" | |
elif random_number == 2: | |
answer = "decidedly so" | |
elif random_number == 3: | |
answer = "without a doubt" | |
elif random_number == 4: | |
answer = "Reply hazy, try again" | |
elif random_number == 5: | |
answer = "ask again later" | |
elif random_number == 6: | |
answer = "Better not tell you now" | |
elif random_number == 7: | |
answer = "My sources say no" | |
elif random_number == 8: | |
answer = "Outlook not so good" | |
elif random_number == 9: | |
answer = "Very doubtful" | |
else: | |
answer = "Error" | |
print(name + " asks " + question) | |
print("Magic 8-Ball's answer: " + answer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment