unibocconi.
eu
Programming with Python
Lecturer: Massimo Ballerini
Language
English
Course description and objectives
The course aims at providing students with the basic elements of the programming
language Python.
Students will acquire all the basic concepts about the programming process, learning
how to use different types of data, how to manage control structures, how to use the
main functionalities and how to create custom ones.
Specifically, at the end of the course, students will be able to:
• Implement simple algorithms
• Import external modules to develop simple software projects
Audience
The course is open exclusively to students of the Master of Science Programs at Bocconi
University and is part of the Enhancing Experience - Curricular Integrative Activities. Upon
successful completion of the course (attendance of at least 75% of the scheduled hours
and passing the final exam), students will get 2 credits and an Open Badge, sharable
across the web (LinkedIn) or personal CV.
Prerequisites
It is essential to know how to manage files and use the local resources of the operating
system installed on your computer.
Duration
24 hours
Teaching mode
Distance learning. Lessons will take place exclusively in synchronous remote mode.
[Link]
The final test on the last day of class, however, can only be taken in physical presence.
Online mode will not be provided.
Calendar
Lecture Date Time Room
1 Mon 03/06/2024 14.45 -16.15 Virtual room
2 Mon 03/06/2024 16.30 - 18.00 Virtual room
3 Wed 05/06/2024 14.45 -16.15 Virtual room
4 Wed 05/06/2024 16.30 - 18.00 Virtual room
5 Fri 07/06/2024 14.45 -16.15 Virtual room
6 Fri 07/06/2024 16.30 - 18.00 Virtual room
7 Mon 10/06/2024 14.45 -16.15 Virtual room
8 Mon 10/06/2024 16.30 - 18.00 Virtual room
9 Wed 12/06/2024 14.45 -16.15 Virtual room
10 Wed 12/06/2024 16.30 - 18.00 Virtual room
11 Fri 14/06/2024 14.45 -16.15 Virtual room
12 Fri 14/06/2024 16.30 - 18.00 InfoAS04/05
Syllabus of the course
Lesson Topics
1 Introduction to Python
- Short Introduction to computer programming languages
- Why to use Python version 3 and how to install it
- IDLE and other development interfaces
- Execution modes
o From the shell
o From the editor
- Where to find support: comments, online help, documentation,
community
Exercises
[Link]
2 Variables and elementary data types
- Variables as memory references
- Variables creation and update with the assignment instruction
- Numeric types and string type
- Introduction to modules (libraries) and built-in functions
- Calculations and execution priorities
- Input and output
- Conversion of data types
Exercises
3 Programming – part 1: conditional constructs and errors
- Simple and nested if (elif)
- Logical operators (and, or, not)
- Conditional operators
- Types of errors
- Debug and test of a program
- Error handling: try and except
Exercises
4 Programming – part 2: iterative constructs
- for and while loops
- Nested cycles
- Forced exit from cycles: break and continue instructions
- How to nest different types of structures
Exercises
5 Programming – part 3: functions
- Defining a function
- Input parameters: mandatory and optional arguments
- Output: productive and void functions
- Recursive functions
Exercises
6 Complex data structures – part 1: what they are
- Structures taxonomy
- Strings, tuples and lists: indexing and slicing
- Dictionaries: keys and values
- How to create, edit, delete elements in a data structure
Exercises
7 Complex data structures – part 2: how to interact
- Strings: methods and functions
- Tuples: methods and functions
- Lists: methods and functions
- Dictionaries: methods and functions
Exercises
[Link]
8 Complex data structures – part 3: custom classes
- The concept of class and instance
- Attributes and methods
- Inheritance
- Overloading and overriding
Exercises
9 Working with the standard library modules
- Use of the standard library
- Examples of standard library modules
Exercises
10 Working with modules of third-party libraries
- Search, installation and use of external modules
- Read and write text files
- Read and write Excel files
Exercises
11 Summary Exercise
Q&A
12
Final test (mandatory)
Software
Python 3.x with IDLE
Suggested bibliography
Clerici A., De Pra M., Debernardi C., Tosi D., Learning Python, Egea, 2020
Reference web links:
• Official site: [Link]
• Official documentation: [Link]
• Repository of official external modules: [Link]
Available seats
This activity is limited to 110 participants and reserved to students of the Master of
Science Programs. Registrations cannot be carried out once this number has been
reached or after closing of the registration period.