Python L2 Calculations and Variables
Python L2 Calculations and Variables
Introducing Python 3
Starter
• In your allocated group, you must as a group
together see if you can resolve the equation on the
whiteboard?
• You have around 4 min for this task. 1 st
Addition
• The equation is: 2nd Multiplication
3rd Division
30 + 20 * 15 / 2
Introduction to Python
Introducing Python 3
Getting it wrong
• Syntax Errors
• Experiment with errors
Keywords
IB
Introduction to Python
Introducing Python 3
What is a variable?
• A variable is a location in memory in which you can
temporarily store text or numbers
• It is used like an empty box or the Memory function
on a calculator
• You can choose a name for the box (the “variable
name”) and change its contents in your program
Introduction to Python
Introducing Python 3
Adding comments
• Comments are useful to help understand your code
• They will not affect the way a program runs
• Comments appear in red
• Comments have a preceding # symbol
#firstname is a variable
print ("What is your name?")
firstname = input()
print ("Hello,",firstname)
Introduction to Python
Introducing Python 3
Calculations
Introduction to Python
Introducing Python 3
Task
• Work through the booklet
‘Calculations and Variables’;
• Add comments after each segment
of code;
• When stopped, you must stop and
listen for specific instructions.
Introduction to Python
Introducing Python 3
Task
• Work through the booklet
‘Calculations and Variables’;
• Add comments after each segment
of code;
• When stopped, you must stop and
listen for specific instructions.
Introduction to Python
Introducing Python 3
Task
• Work through the booklet
‘Calculations and Variables’;
• Work through the booklet
‘Strings and Lists’; ‘If loops’
• Add comments after each segment
of code;
• When stopped, you must stop and
listen for specific instructions.
Introduction to Python
Introducing Python 3
Parenthesis…
Introduction to Python
Introducing Python 3
Starter
• In your allocated group, you must as a group
together see if you can resolve the equation on the
whiteboard?
• You have around 4 min for this task. 1 st
Addition
• The equation is: 2nd Multiplication
3rd Division
30 + 20 * 15 / 2
Introduction to Python
Introducing Python 3
1st Addition
• Q1 Equation: 2nd Subtraction
3rd Division
40 – 67 + 15 / 2