6 ECTS; 1º Ano, 2º Semestre, 42,0 PL + 28,0 TP + 5,0 OT , Cód. 81439.
Lecturer
            - Fernando Sérgio Hortas Rodrigues (1)(2)
(1) Docente Responsável
(2) Docente que lecciona
Prerequisites
          Not applicable
Objectives
          This course unit aims to introduce students to high-level computer programming, specifically through the Python programming language. Upon completing this unit, the student should:  
1) Have a deep understanding of the characteristics of this programming language and know how to install and configure the development environment;  
2) Be familiar with the main commands of the programming language;  
3) Have knowledge of the main existing libraries in Python;  
4) Be able to automate routines using control and iteration structures;  
5) Be able to write and structure programs in Python using arrays;  
6) Be able to write and structure programs in Python using advanced data structures;  
7) Be able to write and structure programs in Python using list comprehensions;  
8) Be able to process text files, Word documents, CSV, JSON, and web documents, as well as understand the importance of OCR (Optical Character Recognition) in text processing from images and PDFs;  
9) Be able to decompose problems into sub-tasks using reusable and anonymous functions;  
10) Be able to create and deploy python modules;  
11) Be able to execute python modules/scripts from the command line;  
12) Be capable of testing and debugging programs;  
13) Be able to manage logs resulting from exceptions.
Program
          1. Programming in Python  
1.1. Why program in Python?  
1.2. History of Python  
1.3. Characteristics  
1.4. Advantages  
1.5. Installing Python  
2. Introduction to Python  
2.1. Comments  
2.2. Help in Python  
2.3. Input and output of information  
2.4. Variables  
2.5. Data types  
2.6. Operators  
2.7. Casting  
2.8. Data formatting  
2.9. Immutability vs Mutability  
2.10. Notebooks in Python  
3. Importing and Using Libraries  
3.1. Internal modules  
3.2. External modules  
3.3. Frequently used modules  
3.4. Introduction to PyPi: Python's official package repository  
3.5. Creating Virtual Environments  
4. Control and Iteration Structures  
4.1. If  
4.2. For  
4.3. While  
4.4. Break/Continue  
5. Simple Data Structures  
5.1. Arrays  
5.2. Multidimensional Arrays  
5.3. Jagged Arrays  
6. Advanced Data Structures  
6.1. Lists  
6.2. Sets  
6.3. Dictionaries  
6.4. Tuples  
6.5. Named Tuples  
6.6. Enums  
7. List Comprehension and LINQ  
7.1. Introduction to list comprehension  
7.2. LINQ in Python  
8. File Reading and Writing  
8.1. Text files  
8.2. Image files  
8.3. PDF files  
8.4. MS Word files  
8.5. HTML files  
8.6. CSV files  
8.7. JSON files  
9. Functions  
9.1. User-defined functions  
9.2. Generator functions  
9.3. Lambda functions (MAP, Filter, Reduce)  
10. Creating and Sharing Modules  
10.1. Introduction to Git (version control system)  
10.2. Introduction to GitHub (source code repository linked to Git)  
10.3. Synchronizing projects with GitHub using Git and the PyCharm development software  
10.4. Creating modules  
10.5. Local module distribution  
10.6. Online module distribution (PyPi and GitHub)  
10.7. Creating packages  
10.8. Local package distribution  
10.9. Online package distribution (PyPi and GitHub)  
11. Command Line  
11.1. Executing code from the command line  
11.2. Passing parameters  
11.3. The `__name__` module  
11.4. Main function  
12. Exceptions  
12.1. Definition  
12.2. Types of errors  
12.3. Exception handling  
13. Logs  
13.1. Log message levels  
13.2. Log formatting  
13.3. Log messages  
13.4. Exception handling within logs  
13.5. Writing logs to files
14. Introduction to Object Orientation
14.1 Class Definition
14.2 Instances
14.3 Constructors
14.4 Class Static Atributes
14.5 Methods
14.6 Iterators
Evaluation Methodology
          Midterm assessment:  Test I  (60%) + Test 2 ( 40%)
Final assessment: Exam (100%)
Please consult the page in portuguese to more detail on this subject.
Bibliography
          - Carvalho, A. (2021). Práticas de Python - Algoritmia e Programação. Lisboa:  FCA
- Costa, E. (2024). Programação em Python - Fundamentos e Resolução de Problemas . Lisboa:  FCA
- Downey, A. (0). Think Python - How to Think Like a Computer Scientist. Acedido em 16 de fevereiro de 2018 em http://greenteapress.com/wp/think-python
- Severance, C. (0). Python for Everybody - Exploring Data Using Python 3. Acedido em 16 de fevereiro de 2018 em http://do1.dr-chuck.com/pythonlearn/EN_us/pythonlearn.pdf
Teaching Method
          Theoretical-Practical classes where the fundamental concepts are described.
Practical classes with practical use-cases solving and application of concepts in real scenarios.
Software used in class
          Python - Anaconda
Jupyter Notebooks
Git
PyCharm

















