An Interest In:
Web News this Week
- March 22, 2024
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
March 27, 2022 04:49 pm GMT
Original Link: https://dev.to/frankpromise/python-code-for-a-treasure-hunt-game-4hkn
python code for a treasure hunt game
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
').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?
"').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?
').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')
Original Link: https://dev.to/frankpromise/python-code-for-a-treasure-hunt-game-4hkn
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To