BASICS OF COMPUTING

Academic Year 2023/2024 - Docente: Giovanni GALLO

Risultati 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

  1. 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.

  2. 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 built-in 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.

  3. 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.

  4. 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.

  5. 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 ad-hoc 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).

Hands-on 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

  1. Introduction to programming

    1. The general structure of a digital computer.

    2. Problems and Algorithms.

    3. Flow chart, Structured linear notation, Böhm-Jacopini theorem.

    4. Representation of information: integers and floating-point numbers, characters, strings.

  2. Computational styles

    1. "Turing-able" programming languages vs spreadsheets;

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

    3. Compilation and interpretation for traditional programming languages.

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

  3. Constructs of Python language

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

    2. Numbers and mathematical functions.

    3. Flow control: consructs of selection and iterative.

    4. Functions and recursion.

  4. Built-in data structures in Python

    1. Strings.

    2. Lists, Tuples, Dictionaries.

  5.  Object oriented programming in Python

    1. General ideas

    2. Basic notation

    3. Examples of simple objects and their usage;

    4. Ereditariety

  6. Advanced topics
    1. Notable algorithms: Searching, Sorting, Merging.

    2. 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

 SubjectsText References
1Introduction to computing and scientific computing
2Spreadsheet model
3Turing-able programming languages, intepretation and compilation
4Python, installation and usage
5Fundamental data types
6Control: conditional, iteration, recursion
7Basic data structures: list, string, tuples
8Object oriented programming
9Important algorithms
10Modules and libraries: examples and usage
11Using 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 handed-in 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

  • 18-20: 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.

  • 21-24: 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.

  • 25-27: the student has agood  knowledge of the topics of the course and can complete the assignemnt in autonomy with minor errors

  • 28-30 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 will include several 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 2-tuples representing
# points on the 2D plane returns two 2-tuples 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 3-tuples like (a,b,c) returns a new dictionary with the same keys but only
# with the 3-tuples 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"
"""

ENGLISH VERSION