LABS: CODING IN ACTION (MODULE I)

LABS: CODING IN ACTION (MODULE I)

Alessandro Celestini

Instructional goals

This course aims at providing an understanding of so-called "computational thinking" and a set of basic programming skills that may be useful in several application settings. Students will first learn how to use the command-line shell. They will then learn generic programming language concepts as they are implemented in Python. Python is a language that is simple to learn yet extremely flexible and powerful. Through a teaching method based on alternating between face-to-face lectures and group work sessions, the students will learn how to tackle a programming problem in complete autonomy and to collaborate with other peers.

Intended learning outcomes

Knowledge and understanding: The course will introduce the students to bash, a shell-specific scripting language, making them familiar with commands and their calling syntax. It will provide the students with an understanding of data structures and control flows, to then cover a few practical issues in statistical computing which include reading data, importing packages, writing functions, and debugging. By the end of this course, the students will gain a solid understanding of how to use the Python standard library to write programs, create functions and classes, write and access external modules. Besides the technical aspects, the special learning methods will teach students the basics of problem solving in a professional environment: how to manage a project, find resources needed to complete it, work in groups, ask for help or provide it to others. Applying knowledge and understanding: This course will teach students how to: • Use a command-line interface to explore a file system and access data • Use the main data types (strings, lists, dictionaries, and more) • Implement Control Flows (if-then statements, looping) • Organize code (functions, modules, packages) • Read and write data from local files (.txt, .csv, .json, etc) Making judgements: Upon completing the study program, students will be able to: • Decompose a problem into sub-problems that are easier to solve • Cooperate with other students to solve a programming problem by sharing the tasks • Design simple algorithms to solve common programming problems • Identify the most suitable data structure for the task at hand Communications Skills: To complete the course, the students will have to work in groups, collaborate with the community to overcome challenges, and share their experience with their peers. This will stimulate their communication skills with respect to all aspects of programming: describing a problem, discussing criticalities, asking for help, explaining an algorithm, commenting code. Learning skills: The innovative teaching method will force students to either find the answers by themselves or ask fellow students. In turn, they will often be asked to transmit notions to someone else. This method allows the students to sharpen their skills through research, experimentation and defending their personal approach to a given problem.

Course Contents

The course will cover the following aspects of computer programming: • An introduction to programming: computer architectures; memory and data; CPU and programs; programming languages; problems, algorithms and programs. • The basics of command-line interfaces and of the bash scripting language. • How to use the Python interpreter: invoking the interpreter; argument passing; interactive mode; notebooks; online coding platforms. • Basic concepts of Python programming: variables and assignments; expressions and statements; operations; printing; comments; debbugging; data types; numbers and strings; input. • Functions: built-in functions; function calls; importing modules and functions; math functions; function composition; defining new functions; parameters and arguments; mandatory vs. optional arguments; arguments’ order and keyword assignment; scope of a variable. • Taking decisions: boolean expressions and logical operators; conditional and alternative execution; if-elif-else statements; chained vs. nested conditionals. • Iterations: reassignment and updating variables; the while statement; the break statement; sequences and looping; the in operator; the 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; lookup and reverse lookup; variable-length arguments. • Files: persistence; opening and closing and the with construct; reading and writing; format operator; filenames and paths; catching exceptions; pickling. • Modules and packages: defining a module; defining a package; importing a package vs. importing a module vs. importing a function; installing packages.

Reference Books

Allen B. Downey, “Think Python: How to Think Like a Computer Scientist (2nd Edition)”, O’Reilly, ISBN-13: 978-1491939369

Teaching Methods

Teaching in through face-to-face lectures will be enhanced by a program based on problem solving. Students will be expected to carry out projects alone or in groups and discuss them with the teacher and other students, who have not necessarily progressed at the same pace. Students will have to justify their choices, explaining why they decided to solve the project in a specific way. These moments help consolidate personal learning and share knowledge with the community. Collective intelligence, which allows good practices to emerge and groups to advance, plays an important role in this teaching method. Students are asked to think for themselves in front of a computer. In this circumstance, making mistakes will not be penalized, but considered part of a learning journey. Pedagogical staff will be on hand to help students find their own solutions.

Assessment Method

During the course, students will be given a set of projects that they must complete as a group in order to progress through the course and successfully pass the exam. These projects must be discussed with the instructor in an oral examination.

Thesis assignment criteria

No thesis will be assigned

Week 1

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.

Week 2

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.

Week 3

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.

Week 4

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.

Week 5

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.

Week 6

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.

Week 7

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.

Week 8

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.

Week 9

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.

Week 10

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.

Week 11

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.

Week 12

Since this is a course organized in the GAP, all the course content, outlined above, will be concentrated in 2 weeks of classes.