HSMA - Programming in Python
Functions, Files and error Handling
28
Exercise: Functions
Attribution and Acknowledgements
How to use this book
Programming Concepts
1
An Introduction to Programming Concepts
Using VSCode, Python and Anaconda
2
The Terminal in VSCode
3
Creating Environments with Python
Your First Steps in Python
4
Intro to Python
5
Printing
6
Variables
7
Variables and Printing together - the fString
8
User Input and Changing Variable Types
9
Mathematical Operators
10
Exercise: 10 years forward
11
Additional Exercises and Resources - Your First Python
Your Next Python Skills
12
Comments
13
Conditional Logic
14
Exercise: Stepping Up
15
Additional Exercises and Resources - Conditional Logic
Loops, Lists and Dictionaries
16
Loops
17
Exercise: Loops
18
Lists
19
List Comprehensions
20
Dictionaries
21
Exercise: Lists and Dictionaries
22
Additional Exercises and Resources - Loops, Lists and Dictionaries
An Introduction to Libraries
23
Importing Packages
24
The Random Library
25
Exercise: Putting it all together
26
Exercise: Coding Challenge 1
Functions, Files and error Handling
27
Functions
28
Exercise: Functions
29
Exception (Error) Handling
30
File Handling
31
Exercise: Handling errors and files
32
Additional Exercises and Resources - Loops, Lists and Dictionaries
Numpy
33
An Introduction to NumPy
34
Using Numpy
35
Handy Numpy Features
36
Exercise: Numpy
37
Additional Exercises and Resources - Numpy
Pandas
38
An Introduction to Pandas
39
Selecting Rows and Columns in Pandas
40
Extending and Joining Dataframes
41
Dropping Data from Dataframes
42
Aggregating Data in Dataframes
43
Sorting, previewing and more with dataframes
44
Exercise: Pandas
45
Additional Exercises and Resources - Pandas
Object-Oriented Python
46
A recap of object oriented programming
47
An Introduction to Object Oriented Python
48
Inheritance
49
Reusability
50
Exercise: Classes
51
Additional Exercises and Resources - OOP
Graphs
52
An Introduction to Matplotlib
53
Chart types in matplotlib
54
Other Plotting Libraries
55
Cheatsheets
56
Further Reading
Table of contents
28.1
Sample Answers
28.2
Answer Video
Functions, Files and error Handling
28
Exercise: Functions
28
Exercise: Functions
Open this exercise in Google Colab:
28.1
Sample Answers
Click here to view the answers
Open exercise solutions in Google Colab:
28.2
Answer Video
Click here to view a video explaining the solution
28.3
Task 1
28.4
Task 2
27
Functions
29
Exception (Error) Handling