Session 1
Output, Operators and Data
Original Copyright Ocado Group 2024
What we are learning about today
At the end of today’s lesson, we will have covered:
● Basic concepts in Python
● Creating and using variables
● Data types
Original Copyright Ocado Group 2024
Why Python?
Easy to read and learn
Open source
Popular in both industry and
the education sector
Runs on many platforms e.g. https://spectrum.ieee.org/top-programming-languages-2022
MacOS, Windows, iOS,
Android
Original Copyright Ocado Group 2024
Mastering new skills
How could you master a skill like
this?
You would need to start with
small exercises and to do lots of
practice
Learning to program is a
practical skill too so you must do
the same!
Image by Freepik: https://www.freepik.com/free-photo/young-man-jumping-with-bmx-bike-skate-park_5669003.htm#query=bmx%20stunt&position=29&from_view=search&track=ais
Original Copyright Ocado Group 2024
Terminology
Algorithm: a finite and ordered set of unambiguous steps to solve a
computational problem – for a person
Program: a sequence of instructions that implements an algorithm – for a
computer
A program is one possible representation of an algorithm
Original Copyright Ocado Group 2024
Getting Started with Python
Python is a text-based programming language
You have to type in all the commands
You must be accurate
Incorrect spellings, case and punctuation will cause errors
Original Copyright Ocado Group 2024
Activity 1: Hello World!
Original Copyright Ocado Group 2024
Activity 1
Hello World!
In your Python IDE, type this and run it
Original Copyright Ocado Group 2024
Activity 1
Did it work?
You should see this:
But you might have got an error
Original Copyright Ocado Group 2024
Activity 1
Did you get an error?
What is wrong here?
Original Copyright Ocado Group 2024
Activity 1
Did you get an error?
Python is case sensitive. You must use print and not Print
Original Copyright Ocado Group 2024
Activity 2: Common Errors
Original Copyright Ocado Group 2024
Activity 2
Common Errors
Do the Common Errors exercises
Original Copyright Ocado Group 2024
Activity 2
Common Errors - Answers
Mark and correct your work
1. Python is case sensitive. You must use print and not PRINT
Original Copyright Ocado Group 2024
Activity 2
Common Errors - Answers
Mark and correct your work
2. You must remember to close any quotation marks that you open
Original Copyright Ocado Group 2024
Activity 2
Common Errors - Answers
Mark and correct your work
3. You must remember to close any brackets that you open
Original Copyright Ocado Group 2024
Activity 3: Mathematical Operators
Original Copyright Ocado Group 2024
Mathematical Operators Activity 3
Try these examples to work out
what each operator does.
Tip: If you are not sure, try
different examples to help you
work it out
Original Copyright Ocado Group 2024
Mathematical Operators - Answers Activity 3
Check your answers and correct
your work, if necessary
This is called the modulus.
Original Copyright Ocado Group 2024
Key Concept: Data Types
A data type is a categorisation of the values that can be stored in a variable and
the operations that can be performed on it.
Integer: a whole number, e.g. 10, -10
Floating Point/Real (Float): a number with a decimal part, e.g. 10.5, 100.0, -7.6
String: anything in quotes, e.g. “Hello”, “12345”, “True”
Boolean: True or False (notice no quotes and initial capital)
Original Copyright Ocado Group 2024
Activity 4: Data Type
Original Copyright Ocado Group 2024
Activity 4
Data Type
Value Data Type
What data type are these values?
-20
1.0
“100”
True
“True”
Original Copyright Ocado Group 2024
Activity 4
Data Type
Value Data Type
Check and correct your work
-20 Integer
0 Integer
1.0 Floating point / Real
“100” String
True Boolean
“True” String
Original Copyright Ocado Group 2024
Activity 5: Investigating print()
Original Copyright Ocado Group 2024
Activity 5
Investigation Tasks
Do these investigation tasks
Code Output Explanation
Original Copyright Ocado Group 2024
Activity 5
Investigation Tasks - Answers
Do these investigation tasks
Code Output Explanation
This adds two integers
Here the + operator joins two
strings
The numbers are in quotes, so
they are treated like a string
Original Copyright Ocado Group 2024
Plenary
We have covered:
● Basic concepts in Python
● Creating and used variables
● Data types
EXIT
T
TICKE What mathematical operator could you use in Python to find
out if one number is divisible by another?
Original Copyright Ocado Group 2024
Original Copyright Ocado Group 2024