Introduction to programming channel 1

Chair (Coordinator) and Rapporteur: MARCO SCHAERF

Objectives

General Objectives:

The goal of the course Introduction to Programming is to provide students with some fundamental techniques of functional and imperative programming through the Python programming language, as well as the study of models for computing. At the end of the course, students will be able to write Python programs involving the use of the programming techniques and data structures introduced during the course. Acquiring the course contents, especially the programming skills, requires the use of a computer.

Specific Objectives:
Knowledge and Understanding: The student will gain a better understanding of programming concepts and data structures by developing Python programs that solve real-world problems

Applying knowledge and understanding: The student will be able to analyze the problem, design its solution and then implement it through the use of the Python language.

Making judgements: The student will be able to identify and critically evaluate the salient aspects of both the analysis and implementation of Python programs, as well as the evaluation of results.

Communication skills: The student will be able to present issues concerning the analysis and solution of computational problems in engineering fields of interest.

Learning skills: The course aims to foster autonomous analytical and learning attitudes oriented towards problem solving.

Learning outcomes

Knowledge of computer programming principles
Ability to solve problems through code development
Understanding of basic computer science principles

Prerequisites

The course does not require any programming knowledge, only high school mathematics concepts

Programme

Introduction to computer science:
Von Neumann architecture, machine language, representation of integer and real numbers, characters and other data types, regular expressions.

Programming in the Python language:
programming with numbers and strings, decision and loop instructions, functions, lists, files and dictionaries

Books

The reference book is one of the following ones (student's choice):

Horstmann, Necaise "Concetti di Informatica e fondamenti di Python", Apogeo Editore,
Horstmann, Necaise "Concetti di Informatica e fondamenti di Python", Apogeo Education; 2nd edition (June 17, 2019)
ISBN-10 ‏ : ‎ 889163543X
ISBN-13 ‏ : ‎ 978-8891635433

Introduction to Computation and Programming Using Python, Second Edition
With Application to Understanding Data
By John V. Guttag
ISBN-10 ‏ : ‎ 0262045788
ISBN-13 ‏ : ‎ 978-0262542364
Published: January 5, 2021
Publisher: The MIT Press

Lessons mode

The lessons are held in the classroom for the theoretical part and in the laboratory for the practical part of programming

Frequency

La frequenza non è obbligatoria, ma fortemente consigliata

Exam mode

To pass the exam, a grade of at least 18/30 is required.
The student must demonstrate sufficient knowledge of Python programming techniques, a basic understanding of advanced programming topics and computer science models, and the ability
to write simple Python programs.
To achieve a grade of 30/30 with honors, the student must demonstrate excellent knowledge of all the topics covered in the course, being able to connect them in a logical and coherent manner.

Example exam questions

1) Write a function that receives as input a list l containing pairs (tuples) of integers and returns the length of the longest sequence of pairs with the property that the second number of the pair on the left is equal to the first number of the pair on the right .

2) Write a function that takes in the name of a text file file, which you can assume contains only alphabetic characters, spaces and '\n', and a string s containing only alphabetic characters (i.e. a word) and returns a dictionary with keys the line numbers (counted starting from 1) and value associated with each key k the list of words in line k that contain all and only the Italian vowels ('aeiou') of s (including repetitions). You don't have to differentiate between uppercase and lowercase letters, so 'Anna' and 'casa' contain the same vowels.

3) Write a function that takes as input a text file in csv file format and a list l. The file contains information about programs to be run by a computer center and lists the information about the computer available to run them. The csv file has the following format:

ProgramName, Operating System, RAM Quantity

where ProgramName is the name of the program to run, OperatingSystem is the name of the operating system this program should run on, and RAMQuantity is the minimum amount of RAM (integer and measured in GB) needed to run the program.

The list has the following format [Operating System,Number of Cores,Amount of RAM available]

Where OperatingSystem is the operating system of the computer, Number of Cores is the number of Cores present in the computer and Amount RAM available is the total (whole) number of GB of RAM available on that computer. Each program must be run on a core of the computer according to the following rule: The programs must be assigned to the cores following the order in which they are found in the file, they must be assigned only if the computer has the right operating system and a number of GB available sufficient (obviously after a program has been assigned to a core, that core is no longer available and the overall available GB drops). If no core satisfies the criteria, the program cannot run.
The function must return a dictionary with key the name of the program and value the number of the core (from 1 to NumeroCores) on which it is run. If no core is available for that program then the value will be 'None'.

Given the 16-bit numeral: 1011110010001000 in pure binary, is it a number < 10^6 ?
Given the 16-bit numeral 01111111111111111 in pure binary, is it a number < 2^16 ?

Sustainability goals

  • Goal4
  • Goal8
  • Goal9
  • Academic year2026/2027
  • Degree program to which the course belongsComputer and Control Engineering
  • Lesson code10626838
  • Year and semester1st year - 1st semester
  • Activity typeBasic educational activities
  • Academic areaMatematica, informatica e statistica
  • SSDIINF-05/A
  • Mandatory presenceNo
  • Languageita
  • CFU9 CFU
  • Total duration90 hours
  • Hours distribution54 classroom hours, 18 training hours, 18 laboratory hours