BASICS OF COMPUTING
Academic Year 2023/2024  Docente: Giovanni GALLORisultati di apprendimento attesi
Synthetic general description
Since this is an internationl course, information will be provided only in English.
The course focuses on an introduction to basic programming skills using Python as reference language.
The imperative/structured programming paradigm will be introduced first, to advance in the second part of the course to the Object Oriented paradigm. Some reference will be provided toward an advanced use of spreadsheet computation models. A final quick introduction to the basic Python libraries for Data Processing, Visualization and Machine Learing will be also provided.
General educational objectives of teaching in terms of expected learning

Knowledge and understanding: the primary goal of the course is the acquisition of the "mind set" of programming, as well as an operative knowledge of Python.

Applying knowledge and understanding: it intends to provide the tools to achieve the following practical and professional skills:
 To analyze computational problems and to code algorithmic ideas for their resolution;
 To design, to describe, to implement and debug Python programs with professional tools;
 To use builtin data structures for data management in scientific computing;
 Understanding simple recursive algorithms;
 To use specific libraries for scientific calculation;
 To be able to read documentation of libraries. 
Making judgements: through the examination of code examples and numerous practice exercises, the learner will be able, both independently and in a cooperative manner, to analyze problems and design and implement related software solutions.

Communication skills: the student will acquire the necessary communication skills and expressive appropriateness in the use of technical verbal language in the context of computer programming.

Learning skills: the course aims to provide the learner with the necessary theoretical and practical methodologies to be used in professional contexts and, in particular, the ability to formulate and implement adhoc algorithms for solving new computational problems as well as the possibility of easily and quickly acquiring other programming languages.
Course Structure
The course will include:
a) frontal classes of mostly theoretical content (blackboard and slides) approx 10 hours;
b) interactive laboratory classes with exercise and direct experiencs (laptop projection, internet connection), students will be encouraged to use their own laptops (not mandatory) for approx 50 hours;
The classes will be held in presence (but different decisions of the authorities).
Handson learning and reference to typical case studies will be used through the full course.
Required Prerequisites
There are no mandatory prerequisites.
It will help a basic knoledge of spreadsheet usage and elementary notions of math and logic.
Problem solving attitude and experience of rigorous quantitative thinking will be helpful.
Attendance of Lessons
Requested according to the rules of the Corso di Studio
Detailed Course Content

Introduction to programming

The general structure of a digital computer.

Problems and Algorithms.

Flow chart, Structured linear notation, BöhmJacopini theorem.

Representation of information: integers and floatingpoint numbers, characters, strings.


Computational styles

"Turingable" programming languages vs spreadsheets;

Basic cycle of computation in a spreadsheet: variables (value, format, dependencies)

Compilation and interpretation for traditional programming languages.

Installation of the development environment for the Python language. First program: Editing, Running, Debugging.


Constructs of Python language

Basic syntax, data types, predefined operators, I/O management.

Numbers and mathematical functions.

Flow control: consructs of selection and iterative.

Functions and recursion.


Builtin data structures in Python

Strings.

Lists, Tuples, Dictionaries.


Object oriented programming in Python

General ideas

Basic notation

Examples of simple objects and their usage;

Ereditariety

 Advanced topics

Notable algorithms: Searching, Sorting, Merging.

Modules. Basic Python libraries for scientific computing and data analysis. Basic data visualization.

Textbook Information
1) A.Downey, Think Python, 2nd Ed., Grean Tea Press (online available).
2) M.Lutz, Learning Python, 4th Ed., O'Reilly (online available).
3) D.Pine, Introduction to Python for Science and Engineering, SMTEBooks  CRC Press (online available).
4) Jessen Havill  Discovering Computer Science: Interdisciplinary Problems, Principles, and Python Programming Chapman and Hall/CRC; 1 edizione (14 settembre 2015)
Course Planning
Subjects  Text References  

1  Introduction to computing and scientific computing  
2  Spreadsheet model  
3  Turingable programming languages, intepretation and compilation  
4  Python, installation and usage  
5  Fundamental data types  
6  Control: conditional, iteration, recursion  
7  Basic data structures: list, string, tuples  
8  Object oriented programming  
9  Important algorithms  
10  Modules and libraries: examples and usage  
11  Using on line references 
Learning Assessment
Learning Assessment Procedures
Course evaluation will be through:
a) a programming assignement to be carried on in class on the exam date in Python (75% of the grade);
b) evaluation of a simple Data Analysis project on Data Set assigned indivdually to the students to be handedin on the exam date (25% of the evaluation)
Grade will be decided according to the following general scheme:
Failed: the student does not know the basic concept of the course and has completed less than 40% of the required assignemnts
1820: the student has a basic knowledge of the topics of the course but he has great difficulties in applying them to practical exercises and problem solving pipelines.
2124: the student has a basic knowledge of the topics of the course and he is able to solve simple prblemns and exercises with some guidance from the teacher.
2527: the student has agood knowledge of the topics of the course and can complete the assignemnt in autonomy with minor errors
2830 e lode:The student has full knowlende of the topics of the course and is able to complete in autonomy assignemnts making connections and with only very minimal occasioanl mistakes.
Examples of frequently asked questions and / or exercises
The exam has to be done using the Jupyter Notebook format.
A typical exam is as follows:
# Exercise 1
# write a function that given a list of strings L
# returns a new list with only the strings that have lenght greater
# than the average lenght of all the strings in the list
# EXAMPLE: in the list ("mamma","papà","figlio","bambino","nonno")
# the mean lenght is (5+4+6+7+5)/5=5.4
# hence the list to return is ("figlio","bambino")
# Exercise 2
# write a funcion that given a list of strings L
# returns a new list of strings of the same length where each string is
# obtained taking the first and the last character in each string of L
# Pay attention to what happens with the empty string!
# EXAMPLE: ("but","if","then","else","at","or","a","")>("bt","if","tn","ee","at","or","a","")
# Exercise 3
# write a function that given a list L of 2tuples representing
# points on the 2D plane returns two 2tuples that have the maximum distance among them
# in case there are more than two piars of point with maximal distance, just return one
# EXAMPLE:
# ((0,0),(0,1),(1,0),(1,1)) > ((0,0),(1,1))
# Exercise 4
# write a function that given a number T and a dictionary D whose keys are integers and
# whose values are 3tuples like (a,b,c) returns a new dictionary with the same keys but only
# with the 3tuples such that a+b+c > T
# EXAMPLE: D={1:(2,4,5),7:(3,2,3),11:(0,0,1)}, T=10 > D'={1:(2,4,5)}
# Exercise 5
"""
Write a class Customer to represent a customer of a bank with given name (string) and
balance (float)
The class must include methods to:
a) tell if a customer has a positive or a negative balance
b) execute a "deposit order" to add money to a customer's balance
b) execute "withdrawal order" to get money off a customer's balance but only
if allowed by the balance or provide the message "insufficient funds"
if the order cannot be executed.
Write a class Bank to represent a collection of customerss.
The class must include:
a) a method to print out the names of all the customers in it
b) the total balance of the bank (sum of the balances of all customers)
Write a class GuarantedCustomer to represent a customer that is
allowed to operate down to a given negative balance fixed at the
creation of the customer.
The class must have a method to execute a "withdrawal order" to get money off
a customer's balance and provide the correct message among:
 "withdrawal within your own funds"
 "withdrawal within the allowed debt"
 "withdrawal not possible, debit limit exceeded"
"""