Introduction
Introduction
CS5800
1
WHO AM I
2
◼︎
◼︎
◼︎
◼︎
◼︎
STRUCTURE
3
◼︎
◼︎
◼︎
◼︎
◼︎
ON DEMAND MATERIAL
4
◼︎
◼︎
LABS
5
◼︎
◼︎
◼︎
◼︎
◼︎
QUIZZES
6
◼︎
◼︎
TOOLS
Moodle - https://moodle.royalholloway.ac.uk/
course/view.php?id=2589
Microsoft Teams
NoMachine
Python and Spyder.
7
◼︎
◼︎
◼︎
◼︎
MOODLE
8
◼︎
◼︎
◼︎
NOMACHINE
9
◼︎
◼︎
PYTHON
10
◼︎
◼︎
ASSESSMENT
11
◼︎
◼︎
ENGAGEMENT
12
◼︎
◼︎
◼︎
◼︎
◼︎
◼︎
ENTRANCE QUIZ
14
MORE PROSAICALLY
15
◼︎
◼︎
◼︎
IN MORE DETAIL
1. Introduction
1. Languages, types, variables
2. The python console
2. Control ow
1. Basic types in Python
2. Comparison operations
3. Branching
4. while, for loops
5. Break
16
fl
fi
fi
1. Dictionaries
1. keys, values
2. Operations
3. Iterating
2. Files, Pandas, Numpy
3. OOP 1
1. OOP concepts
2. Creation, destruction
3. Class attributes, methods
4. Querying types
5. Special methods
4. OOP 2
1. Why use objects?
2. getter and setter methods
3. information hiding
4. hierarchies, inheritance
5. Class variables
17
APPLICABILITY
If you have
◦ No prior experience in programming
◦ You had a little experience in programming
Then this is the module for you.
18
◼︎
◼︎
COURSE INFO: RESOURCES
MIT Course: Introduction to Computer Science and
Programming in Python
◦ https://ocw.mit.edu/courses/electrical-engineering-and-
computer-science/6-0001-introduction-to-computer-science-
and-programming-in-python-fall-2016/index.htm
edX course: https://courses.edx.org/courses/course-
v1:MITx+6.00.1x+2T2018/course/
John Guttag. Introduction to Computation and
Programming Using Python: With Application to
Understanding Data Second Edition. MIT Press, 2016. ISBN:
9780262529624
Numerous other online resources (watch Moodle space and
library reading list)
19
◼︎
◼︎
◼︎
◼︎
FAST-PACED COURSE
20
◼︎
◼︎
Problem Solving
PRACTICE
Knowledge of Programming
Concepts Skills
21
WHAT DOES A COMPUTER DO?
Fundamentally:
◦ performs operations -> calculations
a billion calculations per second!
◦ remembers results
100s of gigabytes of storage!
What kinds of calculations?
◦ built-in to the language
◦ ones that you define as the programmer
Computers only know what you tell them
22
◼︎
◼︎
◼︎
THE ONE TRICK OF COMPUTER
SCIENCE
23
◼︎
◼︎
◼︎
TYPES OF KNOWLEDGE
24
◼︎
◼︎
NUMERICAL EXAMPLE
Square root of a number x is y such that y*y = x
Recipe for deducing square root of a number x
(16)
◦ Start with a guess, g
◦ If g*g is close enough to x, stop and say g is the
answer
◦ Otherwise make a new guess by averaging g and x/
g
◦ Using
g the new guess,
g*g repeat process
x/g until close
(g+x/g)/2
enough
3 9 16/3 4.17
4.17 17.36 3.837 4.0035
4.0035 16.0277 3.997 4.000002
25
◼︎
◼︎
WHAT IS A RECIPE?
1 + 2 + 3 = an algorithm!
26
BASIC
BASIC MACHINE
MACHINEARCHITECTURE
ARCHITECTURE
MEMORY
CONTROL ARITHMETIC
UNIT LOGIC UNIT
program counter do primitive ops
INPUT OUTPUT
6.0001 LECTURE 1 14
27
STORED PROGRAM COMPUTER
• simple tests
• moving data
28
◼︎
◼︎
CREATING RECIPES
29
◼︎
◼︎
◼︎
ASPECTS OF LANGUAGES
ASPECTS OF LANGUAGES
primitive constructs
◦ English: words
◦ programming language: numbers, strings, simple
operators
30
ord Cloud copyright Michael Twardos, All Right Reserved. This content is excluded from our Word Cloud copyright un nown, All Rig
ASPECTS OF LANGUAGE
Syntax
◦ English: “cat dog boy” ➔ not syntactically valid
“cat hugs boy” ➔ syntactically valid
◦ programming language:
“hi”5 ➔ not syntactically valid
3.2*5 ➔ syntactically valid
31
◼︎
ASPECTS OF LANGUAGES
ASPECTS OF LANGUAGES
static semantics is which syntactically valid strings
have meaning
◦ English: "I are hungry" syntactically valid
but static semantic error
◦ programming language: 3.2*5 syntactically valid
3+"hi" static semantic error
32
ASPECTS OF LANGUAGES
33
◼︎
WHERE THINGS GO WRONG
Syntactic errors
◦ common and easily caught
Static semantic errors
◦ some languages check for these before running program
◦ can cause unpredictable behaviour
No semantic errors but different meaning than what
programmer intended
◦ program crashes, stops running
◦ program runs forever
◦ program gives an answer but different than expected
34
◼︎
◼︎
◼︎
WHAT IS PYTHON
35
◼︎
◼︎
WHY PYTHON?
36
◼︎
◼︎
◼︎
◼︎
◼︎
◼︎