INF1-IP: Week 1
Lecture 0 - Introduction to Introduction to Programming
Lecture slides:
Document
Lecture 1 - Algorithmic thinking
Lecture slides:
Document
- Self-guided notebook: see "Files" at the bottom of this page.
Learning outcomes
- What a Python program typically looks like
- Displaying text and values with
print()and collecting text withinput() - Assigning and using variables
- Using arithmetic operators to perform calculations
- Planning programs using decomposition and pseudocode
- Documenting your code with comments
Key terms
Click to expand.
Program
A set of instructions to a computer.
Algorithm
A set of instructions that describes how to solve a problem.
Syntax
The rules of the symbols of a programming language.
Decomposition
Breaking down a problem into smaller, more manageable chunks.
Pseudocode
Computer code written in human-readable format, preserving the exact instructions but ignoring a programming language's particular syntax.
String
A type of value that holds a piece of human text; enveloped in single or double quotation marks.
Escaping characters
In a string, using
\to indicate to Python to ignore a special character that follows.Variable
A name that refers to an object.
Variable assignment
Giving an object a particular name that you can use to refer to it from your code.
Comment
A piece of code that is ignored by the computer, usually used to add human-readable descriptions.
New syntax
Click to expand.
=The assignment operator, giving a name to an object.
'...'and"..."Denote a string.
+,-,*,/Addition, subtraction, multiplication, and division operators, respectively.
(and)(in mathematical expressions)Parentheses that group mathematical expressions to be executed before the expressions outside of the parentheses.
print(content)Displays
contentto the user. Can display multiple values on one line, when separated by,.input(prompt)Displays
promptto the user and asks them to provide input which can be saved to a variable..strip()Removes excess whitespace from the beginning and end of a string.
#Starts a comment, telling Python to ignore the rest of the line.
Further practice
Further practice sections will link to online materials that you might find useful if you want more exercises. Their content might not match one-to-one to what's presented in the lectures but we'll try to match them as close as possible. More will be added over the course of the semester - and if you find any that you find useful yourself, let us know on EdStem and we'll add them here!
From W3Schools:
Tutorial
No tutorial this week.
Assessment
No assessment this week.