Created
March 17, 2022 21:26
-
-
Save JacksonBates/b0e8b4c021b3554d44b3ca1be4bfae41 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# A silly mini text adventure to teach my 8 year old Python | |
import random | |
import time | |
def main(): | |
outcome = random.randint(1,2) | |
print("You are an explorer.") | |
time.sleep(3) | |
print("There is a cave ahead...") | |
time.sleep(3) | |
print('You approach the cave, and hear a sound...') | |
time.sleep(5) | |
print('Do you dare go in?') | |
time.sleep(3) | |
answer = input() | |
if answer == 'yes': | |
time.sleep(5) | |
print("It's very dark...") | |
time.sleep(2) | |
print("Do you turn on your torch?") | |
time.sleep(5) | |
torch = input() | |
if torch == "yes": | |
time.sleep(3) | |
if outcome == 1: | |
time.sleep(3) | |
print("The torch lights up a giant dragon's eye, looking right at you!") | |
time.sleep(5) | |
print("The dragon eats you!") | |
time.sleep(3) | |
print("THE END") | |
else: | |
time.sleep(3) | |
print("You found gold! You're RICH!") | |
time.sleep(3) | |
print("THE END") | |
else: | |
if outcome == 1: | |
time.sleep(3) | |
print("You fumble around in the dark cave.") | |
time.sleep(5) | |
print("You feel something scaly, warm, and...hungry!") | |
time.sleep(2) | |
print("The dragon eats you!") | |
time.sleep(3) | |
print("THE END") | |
else: | |
time.sleep(3) | |
print("You fumble around in the dark cave.") | |
time.sleep(5) | |
print("You found gold! You're RICH!") | |
time.sleep(3) | |
print("THE END") | |
if answer == "no": | |
if outcome == 1: | |
time.sleep(3) | |
print("The sound was behind you!!!") | |
time.sleep(5) | |
print("A dragon eats you!") | |
time.sleep(3) | |
print("THE END") | |
else: | |
time.sleep(3) | |
print("It's probably for the best - time to go home empty handed.") | |
time.sleep(3) | |
print("THE END") | |
if __name__=="__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment