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 … Read more
- 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 … Read more
- Output
- IntroductionPython 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 … Read more
- Visual Studio Setup for PythonDownload 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 … Read more
- Python: 15 String ManipulationW3 Schools Python String Manipulation
- Python: 14 String FormattingThere 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 … Read more
- Python: 13 Iteration – Loops – For
- Python: 12 Iteration – Nested LoopsNested 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 … Read more
- Python: 11 Iteration – Loops – While
- Python: 10 Conditions – elif Statement for If StatementsThe 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 … Read more
- Python: 9 Conditions – If Else Statements
- Python: 08 Conditional and Logical OperatorsConditional 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 … Read more
- Python: 7 ListsA 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. … Read more
-
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 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)
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…