python code for a treasure hunt game
Frank Promise Edah
Posted on March 27, 2022
Learning python has made me realize the importance of repetition. Especially if one is new to it.
Today, i was able to write a basic code for a treasure hunt game without guidiance
print("Welcome to Treasure Island.")
print("Your mission is to find the treasure.")
first_choice = input('You\re on a crossroad, where do you want to go? Left or right\n').lower()
if first_choice == 'left':
second_choice = input('You\ve come to a lake. There is an island in the middle of the lake. Do you wait or swim?\n"').lower()
if second_choice == 'wait':
third_choice = input('You have arrived the island unharmed. There is a house with 3 doors. One red, one yellow and one blue. Which colour do you choose?\n').lower()
if third_choice == 'blue':
print('Eaten by beasts. Game over')
elif third_choice == 'red':
print('burned by fire. Game over')
elif third_choice == 'yellow':
print('You win')
else:
print('Game over.')
else:
print('swallowed by a shark. Game over')
else:
print('oops! wrong choice. Game over')
๐ ๐ช ๐
๐ฉ
Frank Promise Edah
Posted on March 27, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.