You are on page 1of 12

 Lecturers: Chris Leckie

 Tutor: Cameron Chandler


 Version 3.6 Python

Where (do I go)?

 There are three lecturers per week (Mon. Wed. Fri)


 3.15  2.15  1.00
 W01 is tutorial, must attend one each week
 W02 is workshop, optional

L1cs: Basic programming building blocks


- Statements = single command
- Sequence = linear sequence of statements
- Control = if
- Loops = repeat sequences
- Functions = blocks of code that can be run with different inputs
- Recursion = blocks of code that call themselves with different inputs

L2as: Fundamental concept of “print” function


L2b: Types, Variables, and Strings
Type
There are two number types,
int (integer)
float (real number)
Use the function type to determine the type of an object.
Use the function int( ) and float( ) to convert.
Literal
Literals are value that are fixed. They have invariant semantics. a value that is typed directly into
the program
Variables
Arbitrary name to store value, “=” is assignment, an action that takes value and store it
Variable names must start with a character or underscore and consist of only alphanumeric
characters and underscores
Overloading
+ and * mean different things for int and float
snake_case = 1
camelCase = 1
Sequence
A sequence is like a numbered list of objects. strings, lists, tuples
Naming variables

Type
Mutable/Immutable

Operators

Formating newline

Formating f-string
not > and > or
Project 1
Question 1
Question 2

Question 3
Question 4
MST
Examinable material is everything up to and including Week 4 Lecture 2.
Grok worksheets 0-9

 Python basics and types


 Variables and strings
 String manipulation and conditionals
 Functions, methods, tuples
 Lists and sequences
 Iteration
o For: loop variable is variable which changes each time the code in a for loop is
repeated, taking the value of successive items in the sequence being looped
through.
o While: initialization, condition, execution. Identify 3 things, what loop variable is
initialized to, how the loop variable is incremented during each iteration, when
the loop terminates
 Nested loops

You might also like