01: Python: Output

Try it:

Write a program that displays an output
Output: Write a program that displays an output

Below you’ll see some example python code that will output three things to the screen.

Press Ctrl + Enter  to run the code.

Click on your score in the top right corner of the code editor to see what your code needs to do.

Any line of code that starts with a #  is a comment: it doesn’t affect how the program runs, it’s just there to help explain what the code does.


  1. Change Line 3 to say Hello instead of Hi

    Notice that to display text output in python you need to surround your message in quotation marks. The print function also needs your output to be surrounded with brackets

  2. Change the ‘ to a ” on line 5

    Notice that you’ll need to put a \  in front of the   like you see in front of the word Hello. This is called ‘escaping’ the   because  is a special character used to surround all the text you want to output to the screen.

  3. Add the missing line to Twinkle Twinkle Little star

    Notice that line 7 and 9 has “””  at the start and end of the text to display instead of just  . The triple quotation marks mean you can write text over multiple lines.

On the next page you’ll get some code examples that have been deliberately broken for you to try to fix.


KPRIDE stands for Keywords, Predict, Run, Investigate, Debug and Extend and it’s a way of helping you explore and understand python code. Click on the image below for a set of KPRIDE activities for this python skill.KPRIDE

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.

9 thoughts on “01: Python: Output

  • Pingback: Python for beginners: free interactive self marking activities

  • February 26, 2019 at 12:49 pm

    it was amazing

    • January 6, 2021 at 10:46 am

      the work was really cool

  • February 25, 2020 at 1:02 pm


  • January 6, 2021 at 5:29 pm

    Thank you so much for removing the Google Adverts and your swift response. Do you have somewhere dontations can be made or similar to make up for the lost revenue, I’d throw in a least a cup of coffee…

    • January 7, 2021 at 8:58 pm

      You’re welcome. That’s a very kind offer but don’t worry about it – I’ll switch to a different ad provider that doesn’t show such intrusive ads or gives more control over where they’re placed. Look after yourself – all the best for this new lockdown.


Leave a Reply

Your email address will not be published. Required fields are marked *