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 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.
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 ad-hoc algorithms for solving new computational problems as well as the possibility of easily and quickly acquiring other programming languages.
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.
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.
Requested according to the rules of the Corso di Studio
Introduction to programming
The general structure of a digital computer.
Problems and Algorithms.
Flow chart, Structured linear notation, Böhm-Jacopini theorem.
Representation of information: integers and floating-point numbers, characters, strings.
Computational styles
"Turing-able" 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.
Built-in 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
Notable algorithms: Searching, Sorting, Merging.
Modules. Basic Python libraries for scientific computing and data analysis. Basic data visualization.
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)
Argomenti | Riferimenti testi | |
---|---|---|
1 | Introduction to computing and scientific computing | |
2 | Spreadsheet model | |
3 | Turing-able 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 |
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.
# 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"
"""