Masters in Data Science applied to agricultural and food sciences, environment, and forestry engineering.
Instructor: Manuel Campagnolo (mlc@isa.ulisboa.pt)
Teaching assistant: Mekaela Stevenson (mekaela@edu.ulisboa.pt)
>>> import this
and many other anecdotes about Python.CS50P | Contents | PP.fi | Contents |
---|---|---|---|
Lecture 0 | Creating Code with Python; Functions; Bugs; Strings and Parameters; Formatting Strings; More on Strings; Integers or int; Readability Wins; Float Basics; More on Floats; Def; Returning Values | Part 1 | Intro; I/O; More about variables; Arithmetic operations; Conditional statements |
Lecture 1 | Conditionals, if Statements, Control FlowModulo; Creating Our Own Parity Function; Pythonic; match | Part 2 | Programming terminology; More conditionals; Combining conditions; Simple loops |
Lecture 2 | Loops; While Loops; For Loops; Improving with User Input; More About Lists; Length; Dictionaries, More on code modularity | Part 3 | Loops with conditions; Working with strings; More loops; Defining functions |
Part 4 | The Visual Studio Code editor, Python interpreter and built-in debugging tool; More functions; Lists; Definite iteration; Print statement formatting; More strings and lists | ||
Part 5 | More lists; References; Dictionary; Tuple | ||
Lecture 3 | Exceptions, Runtime Errors, try, else, Creating a Function to Get an Integer, pass | Part 6 | Reading files; Writing files; Handling errors; Local and global variables |
Lecture 4 | Libraries, Random, Statistics, Command-Line Arguments, slice, Packages, APIs, Making Your Own Libraries | Part 7 | Modules; Randomness; Times and dates; Data processing; Creating your own modules; More Python features |
Lecture 5 | Unit Tests; assert; pytest; Testing Strings; Organizing Tests into Folders | ||
Lecture 6 | File I/O; open; with; CSV; Binary Files and PIL | ||
Lecture 7 | Regular Expressions; Case Sensitivity; Cleaning Up User Input; Extracting User Input | ||
Lecture 8 | Object-Oriented Programming; Classes; raise; Decorators; Class Methods; Static Methods; Inheritance; Inheritance and Exceptions; Operator Overloading | Part 8 | Objects and methods; Classes and objects; Defining classes; Defining methods; More examples of classes |
Part 9 | Objects and references; Objects as attributes; Encapsulation; Scope of methods; Class attributes; More examples with classes | ||
Part 10 | Class hierarchies; Access modifiers; Object oriented programming techniques; Developing a larger application | ||
Lecture 9 | set; Global Variables; Constants; Type Hints; Docstrings; argparse; Unpacking; args and kwargs; map; List Comprehensions; filter; Dictionary Comprehensions; enumerate; Generators and Iterators | Part 11 | List comprehensions; More comprehensions; Recursion; More recursion examples |
Part 12 | Functions as arguments; Generators; Functional programming; Regular expressions |
code filename.py
to create a new filels
to list files in foldercp filename newfilename
to copy a file, e.g. cp ..\hello.py farewell.py
(..
represents parent folder)mv filename newfilename
to rename or move file, e.g. my farewell.py goodbye.py
or mv farewell.py ..
(move one folder up)rm filename
to delete (remove) filemkdir foldername
to create new foldercd foldername
change directory, e.g. cd ..
rmdir foldername
to delete folderclear
to clear terminal windowstr
), variables, print (a function), parameters (e.g. end=
), input, comments, formatted strings (f"..."
), .strip()
, .title
(methods)int
), operations for integers, casting (e.g. str
to int
)float
), round, format floats (e.g. f"{z:.2f}
)True
, False
, and
, or
, not
def
, return