Python Beginners- Week 5: Adventure Game and Comparing Python Functions to Scratch Blocks

Today we finished our adventure game. Here is the source for it.

#This is my adventure game

import time

def scene1():
 print('You are standing on a trail in a forrest')
 print('Before you the trail splits in two')
 print('Which way will you go right or left?''\n')
def makeChoice():
 choice = ''
 while choice != '1' and choice != '2':
 print('Press 1 followed by enter to choose the first option')
 print('Press 2 followed by enter to choose the second option')
 choice = input()
 return choice

def scene2A():
 print('\n''You come to a stream with bridge')
 print('You can cross and follow the trail that leads from the bridge')
 print('or follow the trail that leads along the nearside of the river''\n')

def scene2B():
 print('\n''you come to a steep hill')
 print('you can climb over the hill')
 print('or you can follow the trail which leads around it','\n')

def goodEnd():
 print('You travel along until you hear people''\n')
 print('They sound like they are having fun''\n')
 print('You suddenly see them and realise it\'s your friends having a picnic')
 print ('they share their food and drinks with you and you have a great time')

def badEnd():
 print('You travel along''\n')
 print ('on and on''\n')
 print('you have no idea where you are''\n')
 print('suddenly you realise you are back where you started')
#main program starts here
playAgain = 'yes'
while playAgain == 'yes' or playAgain == 'y':


#use the makeChoice function to get
 #the player to decide which way to go
 firstChoice = makeChoice()

#this if else statement will show the next
 #scene based on the players choice
 if firstChoice == '1':

secondChoice = makeChoice()

#this if else statement will show the next
 #scene based on the players choice
 if secondChoice == '1':

print('Do you want to play again? (yes or no)')
 playAgain = input()

We also took a look at Snap which is an extended re-implementation of Scratch that allows us to build our own blocks. Snap is available at We compared our Python code to a similar Snap script.


We compared Python functions to Scratch blocks and made a few blocks of our own using Snap. Here are my slides from today. python session5

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s