Menu Button
Code: The Haunted House – Python Practice (KS3)
Back to Jamaica Resources

1 Story Outputs with print()

By the end of this task, you will:
  • Understand how the print() function outputs text in Python
  • Use matching quotation marks for text strings
  • Output multiple lines of story text sequentially
Edit lines 3 and 4 below

2 Coding Lesson: Debugging Case Sensitivity & Spelling

By the end of this task, you will:
  • Identify and fix spelling mistakes in print() statements
  • Correct capital letter errors in Python function names
  • Fix SyntaxErrors caused by missing quotation marks
Click Run Code to see the errors, then fix them line by line!

3 Code Notes & Comments (#)

By the end of this task, you will:
  • Understand how Python ignores lines starting with #
  • Write clear comments to document your code
  • Uncomment lines of code to activate them
Uncomment line 1 and add a comment on line 4

4 Tracking State with Variables

By the end of this task, you will:
  • Create variables to store changing game information
  • Follow snake_case naming conventions for variables
  • Reassign new values to existing variables
Update key_location and create current_room

5 Game Rules with Constants

By the end of this task, you will:
  • Distinguish between variables and fixed constants
  • Define constant values using UPPERCASE naming
  • Output constants alongside text messages
Define MAX_LIVES and print GHOST_DAMAGE

6 Text Data (Strings)

By the end of this task, you will:
  • Define string variables to store text data
  • Concatenate strings using the + operator
  • Display room and character descriptions dynamically
Assign string variables and use + join

7 Numbers & Arithmetic (Integers)

By the end of this task, you will:
  • Store numeric data using whole numbers (integers)
  • Perform basic arithmetic operations (+, -, *)
  • Track and calculate player stats like score and remaining doors
Perform subtraction and print total_score

8 True/False Flags (Booleans)

By the end of this task, you will:
  • Use True and False boolean values to track game states
  • Apply correct capitalization rules for Python booleans
  • Update boolean flags when game events occur
Set boolean flags and print status

9 Interactive Choices with input()

By the end of this task, you will:
  • Prompt players for text responses using input()
  • Store user input directly inside variables
  • Use player responses to make interactive storyline choices
Complete prompt text and print choice

10 Branching Logic (if)

By the end of this task, you will:
  • Write if statements to evaluate game conditions
  • Use the comparison operator == to check matching values
  • Apply 4-space indentation to format conditional code blocks
Fix syntax and write an if statement

11 Fallback Paths (else)

By the end of this task, you will:
  • Use else statements to handle alternative conditions
  • Format else: blocks with correct syntax and indentation
  • Provide fallback outcomes for invalid or alternate player choices
Add an else block

12 Multiple Paths (elif)

By the end of this task, you will:
  • Chain multiple condition checks using elif blocks
  • Build multi-branch choices for exploring complex paths
  • Order conditional logic from top to bottom effectively
Add elif choice for door 2

13 Repetition with while Loops

By the end of this task, you will:
  • Construct while loops to repeat code based on conditions
  • Decrement counter variables to prevent infinite loops
  • Implement retry limits for puzzles and passcode doors
Fix while loop condition and countdown

14 Storing Items in Lists

By the end of this task, you will:
  • Create lists using square brackets [] to hold multiple items
  • Add elements dynamically using the .append() method
  • Access list items using zero-based index numbers
Append brass_key and print index 0