Extend it:

Use and store data in files
Writing data to a file in python

For this challenge you will need write a children’s story to the file story.txt

Your story could be randomly generated or you could just write it line by line.

The starting point for your code just opens the file ready to write

Challenges:

 
  1. Start the story with “Once upon a time”

    Hint: Make sure you include a capital letter

  2. Make your story at least 10 lines long

    Hint: Don’t forget to add \n each time you want a new line

  3. Ask the user a question (e.g. their name) and use their answer in the story

    Hint: use input to ask a question and save the user’s answer into a variable

Page 1: Intro

Page 2: The theory: learn what you need to know as fast as possible.

Page 3: Try it: try out and adapt some working python code snippets.

Page 4: Debug it: Learn how to find and fix common mistakes.

Page 5: Extend it: Choose a project idea to use your newfound python skills.