20410560-1 - MODULO A - PYTHON programming

Acquire the ability to implement high-level programs in the interpreted language Python . Understand the main constructs used in Python and its application to scientific computing and data processing scenarios.

Curriculum

scheda docente | materiale didattico

Mutuazione: 20410560-1 MODULO A - PROGRAMMAZIONE IN PYTHON in Scienze Computazionali LM-40 Onofri Elia

Programma

The course will cover the following aspects of Python programming:

• Introduction to Programming: Computer architectures; memory and data; CPU and programs; programming languages; problems, algorithms, and programs.
• Using the Python Interpreter: Invoking the interpreter; passing arguments; interactive mode; notebooks; online coding platforms.
• Basic Python Programming Concepts: Variables and assignments; expressions and statements; operations; printing; comments; debugging; data types; numbers and strings; input.
• Functions: Built-in functions; function calls; importing modules and functions; mathematical functions; function composition; defining new functions; parameters and arguments; required and optional arguments; argument order and keyword assignment; variable scope.
• Making Decisions: Boolean expressions and logical operators; conditional and alternative execution; if-elif-else structure; chained and nested conditionals.
• Iterations: Variable reassignment and updates; while loop; break statement; sequences and loops; the in operator; for loop.
• Data Structures (strings, lists, tuples, dictionaries): Definition, properties, operations, and methods; indexing vs. assignment; mutability and immutability; map, filter, and reduce; referencing and aliasing; packing and unpacking; search and reverse search; variable-length arguments.
• Files: Persistence; opening and closing files with the with statement; reading and writing; format operator; file names and paths; handling exceptions; pickling.
• Modules and Packages: Defining a module; defining a package; importing a package vs. importing a module vs. importing a function; installing packages.
• Classes and Objects: Classes, types, objects, and instances; instances as return values; attributes and methods; object mutability; instantiation and the __init__ method; operator overloading and special methods; static methods and class methods; inheritance.
• Pythonic Programming: Conditional expressions; EAFP (Easier to Ask for Forgiveness than Permission); list comprehensions; generator expressions; any and all operators; sets.
• Scientific Programming: Numpy, arrays, and broadcasting; Pandas, dataframes, and series; Scikit-Learn and an introduction to machine learning with Python; Matplotlib and data visualization in Python.

Testi Adottati

Allen B. Downey, “Think in Python" (2nd edition)”, Green Tea Press, 2015

Modalità Frequenza

Attendance is not mandatory, but it is strongly recommended (see the evaluation details).

Modalità Valutazione

The assessment is divided into three parts: • Practical exam [max 20 points], which can be completed through: - 5 in-class exercises (every Thursday, except the first one) to be submitted by the end of the lesson - A short final project to be agreed upon with the instructor • Final multiple-choice written exam [max 10 points] • Oral exam (optional)

scheda docente | materiale didattico

Mutuazione: 20410560-1 MODULO A - PROGRAMMAZIONE IN PYTHON in Scienze Computazionali LM-40 Onofri Elia

Programma

The course will cover the following aspects of Python programming:

• Introduction to Programming: Computer architectures; memory and data; CPU and programs; programming languages; problems, algorithms, and programs.
• Using the Python Interpreter: Invoking the interpreter; passing arguments; interactive mode; notebooks; online coding platforms.
• Basic Python Programming Concepts: Variables and assignments; expressions and statements; operations; printing; comments; debugging; data types; numbers and strings; input.
• Functions: Built-in functions; function calls; importing modules and functions; mathematical functions; function composition; defining new functions; parameters and arguments; required and optional arguments; argument order and keyword assignment; variable scope.
• Making Decisions: Boolean expressions and logical operators; conditional and alternative execution; if-elif-else structure; chained and nested conditionals.
• Iterations: Variable reassignment and updates; while loop; break statement; sequences and loops; the in operator; for loop.
• Data Structures (strings, lists, tuples, dictionaries): Definition, properties, operations, and methods; indexing vs. assignment; mutability and immutability; map, filter, and reduce; referencing and aliasing; packing and unpacking; search and reverse search; variable-length arguments.
• Files: Persistence; opening and closing files with the with statement; reading and writing; format operator; file names and paths; handling exceptions; pickling.
• Modules and Packages: Defining a module; defining a package; importing a package vs. importing a module vs. importing a function; installing packages.
• Classes and Objects: Classes, types, objects, and instances; instances as return values; attributes and methods; object mutability; instantiation and the __init__ method; operator overloading and special methods; static methods and class methods; inheritance.
• Pythonic Programming: Conditional expressions; EAFP (Easier to Ask for Forgiveness than Permission); list comprehensions; generator expressions; any and all operators; sets.
• Scientific Programming: Numpy, arrays, and broadcasting; Pandas, dataframes, and series; Scikit-Learn and an introduction to machine learning with Python; Matplotlib and data visualization in Python.

Testi Adottati

Allen B. Downey, “Think in Python" (2nd edition)”, Green Tea Press, 2015

Modalità Frequenza

Attendance is not mandatory, but it is strongly recommended (see the evaluation details).

Modalità Valutazione

The assessment is divided into three parts: • Practical exam [max 20 points], which can be completed through: - 5 in-class exercises (every Thursday, except the first one) to be submitted by the end of the lesson - A short final project to be agreed upon with the instructor • Final multiple-choice written exam [max 10 points] • Oral exam (optional)

scheda docente | materiale didattico

Mutuazione: 20410560-1 MODULO A - PROGRAMMAZIONE IN PYTHON in Scienze Computazionali LM-40 Onofri Elia

Programma

The course will cover the following aspects of Python programming:

• Introduction to Programming: Computer architectures; memory and data; CPU and programs; programming languages; problems, algorithms, and programs.
• Using the Python Interpreter: Invoking the interpreter; passing arguments; interactive mode; notebooks; online coding platforms.
• Basic Python Programming Concepts: Variables and assignments; expressions and statements; operations; printing; comments; debugging; data types; numbers and strings; input.
• Functions: Built-in functions; function calls; importing modules and functions; mathematical functions; function composition; defining new functions; parameters and arguments; required and optional arguments; argument order and keyword assignment; variable scope.
• Making Decisions: Boolean expressions and logical operators; conditional and alternative execution; if-elif-else structure; chained and nested conditionals.
• Iterations: Variable reassignment and updates; while loop; break statement; sequences and loops; the in operator; for loop.
• Data Structures (strings, lists, tuples, dictionaries): Definition, properties, operations, and methods; indexing vs. assignment; mutability and immutability; map, filter, and reduce; referencing and aliasing; packing and unpacking; search and reverse search; variable-length arguments.
• Files: Persistence; opening and closing files with the with statement; reading and writing; format operator; file names and paths; handling exceptions; pickling.
• Modules and Packages: Defining a module; defining a package; importing a package vs. importing a module vs. importing a function; installing packages.
• Classes and Objects: Classes, types, objects, and instances; instances as return values; attributes and methods; object mutability; instantiation and the __init__ method; operator overloading and special methods; static methods and class methods; inheritance.
• Pythonic Programming: Conditional expressions; EAFP (Easier to Ask for Forgiveness than Permission); list comprehensions; generator expressions; any and all operators; sets.
• Scientific Programming: Numpy, arrays, and broadcasting; Pandas, dataframes, and series; Scikit-Learn and an introduction to machine learning with Python; Matplotlib and data visualization in Python.

Testi Adottati

Allen B. Downey, “Think in Python" (2nd edition)”, Green Tea Press, 2015

Modalità Frequenza

Attendance is not mandatory, but it is strongly recommended (see the evaluation details).

Modalità Valutazione

The assessment is divided into three parts: • Practical exam [max 20 points], which can be completed through: - 5 in-class exercises (every Thursday, except the first one) to be submitted by the end of the lesson - A short final project to be agreed upon with the instructor • Final multiple-choice written exam [max 10 points] • Oral exam (optional)