Python : Hello World

This short exercise will cover topics relevant to GCSE computing including:

  • Variables
  • Data Types
  • User Input
    1. Log in (or register) at
    2. Create a ‘New Repl’
    3. Then choose ‘Python 3’ as the language
    4. Type the following code into the left pane:
      name = input("What is your name ?")
      print("Hello " + name)
    5. Then click the ‘run’ button at the top.

You should see the output of your code in the dark panel on the left:

Think About the Code

  • Line 1 creates a variable called ‘name’ and stores the answer from the user ‘input’
  • Line 2 uses ‘print’ to say Hello and outputs the contents of the ‘user’ variable


  • Variable – we use the word ‘variable’ for a . Think of it as a storage box that we can put stuff into and then take it out again later.
  • Data Type – in code variables can be numbers or text. We need to use the correct data types or we may create bugs. Imagine asking the computer to multiply 3 by John or even multiply 3 by seven. In both cases the computer will be confused as it can’t multiply a number by some text – so in future we may need to tell the computer the ‘Data Type’ we expect to use. In the exercise above we only used text or ‘strings’ so we did not encounter any problems.
  • User Input – We used a special command called ‘input’ to prompt the user to enter some information
  • Output – We used a special command called ‘print’ to show output on the screen
  • Functions – In computing we usually call special commands like ‘input’ and ‘print’ functions.


Try Roll the Dice next.

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>