Lesson 1: Python Fundamentals
To Know - Control Structures in Python
To Be Able To - Identify Control Structures in Python
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.
57.9% of programmers use Python
Python is used by:
Meta
Netflix
Spotify
NASA
Sequence
Selection
Iteration
Functions
Variables
Indentation
Steps executed in a strict, linear order.
Decision-making, chooses a path based on a condition.
Repeating a block of code, given the code meets a condition.
A reusable block of code designed to perform a specific task.
Containers for storing data values.
Data Values:
string - text
integer - whole numbers
float - numbers w/decimal
boolean - true/false
The leading whitespace (spaces or tabs) at the beginning of a line.
Python uses it as a mandatory syntax rule to define code blocks.
List parts of python code
Together we are going to break down this code, labelling each of the fundemental python concepts we just learnt about.
Using the code sample below and what you have just learnt answer the following questions.
IF, ELIF & ELSE are examples of what control structure.
What are the two different types of iteration (loops).
Write a two lines of code that:
Declares a variable called ‘number’ as equal to ‘3’.
Creates a forever loop.
What would be outputted in the below code if:
‘Button B’ is pressed.
Micro:Bit is ‘Shaken’.