Python 03 Setup


In this section you will find examples of how to code using Python 3

This guide will cover key concepts in programming using Python 3 for examples.

Throughout each of the lessons / sections there will be activities to complete.

Where there are code examples you should try them yourself

Just reading the examples will not help you much.

  • Input (1)
    Reading input is really important in programming. It means that we can interact with the computer program. There are a number of methods of doing this. Here we will focus […]
  • Variables
    Variables are used to store data and the contents of them can be changed. This could be strings (text), numbers (integers, floats / decimals), or booleans (true or false). Variables […]
  • Fixing Errors (1)
    Try running the program below: There will be a number of errors that are detected when the program runs. The ones here are called syntax errors as they are due […]
  • Output
    Create a new file in your editor of choice called ex_1_output.py Enter the code shown below. We are using the print function. You can identify functions in Python as they […]
  • Introduction
    Python is a high level third generation programming language. Python is an interpreted language as opposed to a compiled language. This means that each line of Python code is executed […]
  • Visual Studio Setup for Python
    Download and install Python 3 first if it’s not already installed. Once Python is installed restart your computer before moving to the next step. Download Visual Studio Code if you […]
  • Python: 15 String Manipulation
    W3 Schools Python String Manipulation
  • Python: 14 String Formatting
    There are a lot of different ways to format and display text in Python. You can find a lot of excellent reference materials on W3 Schools. Using { } inside […]
  • Python: 13 Iteration – Loops – For
    A for loop is used to iterate over a known number of items or a list. It is used when you know how many times the loop will need to […]
  • Python: 12 Iteration – Nested Loops
    Nested loops are loops inside other loops. Note that the outer loop (first_word) is run first and then the code block encounters the second inner loop (second_word). The inner loop […]
  • Python: 11 Iteration – Loops – While
    Iteration is the programming concept of repeating or looping sections of code. In Python there are two main types of loops while and for. The while loop runs code so […]
  • Python: 10 Conditions – elif Statement for If Statements
    The elif statement is short for else if. This is used for giving multiple options with an if statement. In the example above the age is set to 25. (You […]
  • Python: 9 Conditions – If Else Statements
    If else statements allow for a program to select the code to run based on the outcome of a true / false condition. Look on W3 Schools for more information […]
  • Python: 08 Conditional and Logical Operators
    Conditional and logical operators are used to make statements that can be evaluated (worked out) to be True or False. True and False are keywords in Python to store true […]
  • Python: 7 Lists
    A list is a collection that is ordered and has changeable content. There are other data collection methods in python such as: List is a collection which is ordered and changeable. […]
  • Input (1)

    Input (1)

    Reading input is really important in programming. It means that we can interact with the computer program. There are a number of methods of doing this. Here we will focus on using the Python input function to read input and assign the data entered to a variable. The input function returns a value which is […]


  • Variables

    Variables

    Variables are used to store data and the contents of them can be changed. This could be strings (text), numbers (integers, floats / decimals), or booleans (true or false). Variables must start with a letter. When naming variables (and functions) in Python we use an _ to separate different words. For example a variable to […]


  • Fixing Errors (1)

    Fixing Errors (1)

    Try running the program below: There will be a number of errors that are detected when the program runs. The ones here are called syntax errors as they are due to the errors being due to the text we have used in our code. These are different to logic errors which the code will run […]