Strumenti Utente

Strumenti Sito


Programming for Data Science A.Y. 2017/18

This is an introductory course to computer programming and related mathematical/logic background for students without a Bachelor in Computer Science or in Computer Engineering. The objective is to smoothly introduce the student to the programming concepts and tools needed for typical data processing and data analysis tasks. The course consists of lectures and practice in computer labs.



Day of Week Hour Room Type
Monday 11:00 - 13:00 Fib C1 Lectures
Tuesday 9:00 - 11:00 Fib C1 Lectures
Wednesday 16:00 - 18:00 Fib M-Lab Labs
Thursday 11:00 - 13:00 Fib M-Lab Labs

Office hours

  • Prof. Prencipe: Wednesdays h 15:00 - 19:00 or by appointment, Department of Computer Science, room 327/DO.
  • Prof. Ruggieri: Tuesdays h 14:00 - 17:00 or by appointment, Department of Computer Science, room 321/DO.

Text Books

  • [T] Kenneth H. Rosen. Discrete Mathematics and Its Applications. Seventh Edition, MCGraw-Hill, 2012. Supplement material (including Errata-Corrige).
  • [P] Pieter Spronck. The Coder’s Apprentice: Learning Programming with Python 3, 2017. Book and supplement material.
  • [C] Brian W. Kernighan, Dennis M. Ritchie. C Programming Language. Second Edition, Prentice Hall, 1988.
  • [A] David A. Patterson,‎ John L. Hennessy. Computer Organization and Design. Fifth Edition, The Morgan Kaufmann Series in Computer Architecture and Design, 2014. MKComputerOrganizationAndDesign-1stChapter.pdf
  • [O] Paolo Ancilotti, Maurelio Boari, Anna Ciampolini, Giuseppe Lipari. Sistemi Operativi. McGraw-Hill, 2008


  • Python programming: Anaconda distribution of Python 3. Computers at lab rooms include it both on Linux and Windows OS.
  • C programing: either gedit (or equivalent text editor) and gcc. If you do not have gcc on your machine, check next item. Gedit and gcc are available on computers at lab room (Linux only).
  • gcc compiler: To be able to compile C programs, you need to have a gcc compiler installed on your machine. If you use Linux….well, why are you still reading? :) If you use macOSX, almost no problems: just install XCode; then from Xcode Preferences > Downloads choose “Command line tool”, and install it as well: you will have gcc on your machine. Finally, for Windows users, you need to install any gcc compiler. You have two options:
    • (1) install minGW minGW. Once the MinGW Installation Manager has been installed, execute it and install the whole MinGW package (from the Package menu). After everything has been downloaded and installed, you first need to set the PATH environment variable (see here: set Windows PATH); now, you will also have gcc compiler on your machine.
    • (2) install DevC++: write and save your program, and then compile and run it by accessing the Execute menu.
  • Compile C on lab machines (Windows) Use DevC++.
  • Editor for C files Either use the DevC++ editor, or use Notepad++ .
  • Python/C online including visualization of memory state PythonTutor.

Preliminary program and calendar


Registration to exams and mid-terms is mandatory: register here

Next exam (reserved session) will be on Wednesday 4th of April, from 2pm to 6pm, Lab H.

IMPORTANT: To be able to solve the C exercises during the exam, you need to use DevC++ installed in the Windows partition of the computers' lab. Please, read carefully the instructions in the Software section above.

Day Hour Room Type
30.10.2017 9:00 - 11:00 M-Lab First Mid-Term
18.12.2017 11:00 - 13:00 M-Lab Second Mid-Term
15.1.2018 9:00 - 13:00 M-Lab Regular Exam
12.2.2018 9:00 - 13:00 M-Lab Regular Exam

Mid-terms text and solutions: and

Sample exam texts and solutions:,

Class calendar

Recordings are password protected. Ask the teachers for credentials.

Day Room Topic Learning material Recordings Instructor
1. 18.9 11:00-13:00 C1 Introduction. Propositional logic. [T: 1.1-1.3] 20170918.flv Ruggieri
2. 19.9 9:00-11:00 C1 Exercises. Rules of inference for propositional logic. [T: 1.6] 20170919.flv Ruggieri
3. 20.9 16:00-18:00 M-Lab Algorithms and programming: notions, programming steps, states, expressions and assignment. Introduction to Python. Data types, expressions using numbers, variables. [P: 1-4] 20170920.mp4 Prencipe
4. 21.9 11:00-13:00 M-Lab Exercises and programming practice. [P: 1-4] Esercizi1.pdf Prencipe
5. 25.9 11:00-13:00 C1 Predicate logic. [T: 1.4-1.6] 20170925.flv Ruggieri
6. 26.9 9:00-11:00 C1 Simple functions, input, if-else, if-elif-else, while, for. [P: 4-7] 20170926.mp4 Prencipe
7. 27.9 16:00-18:00 M-Lab Sets. Sets in Python. [T: 2.1-2.2] 20170927.flv Ruggieri
8. 28.9 11:00-13:00 M-Lab Iterations and their use. [P: 7] Esercizi2.pdf Prencipe
9. 2.10 11:00-13:00 C1 Exercises on predicate logic and sets. 20171002.flv Ruggieri
10. 3.10 9:00-11:00 C1 Functions, sequences, cardinality, matrices. [T: 2.3-2.6] 20171003.flv Ruggieri
11. 4.10 16:00-18:00 M-Lab Functions and recursion. [P: 8-9] 20171005.mp4 Prencipe
12. 5.10 11:00-13:00 M-Lab Functions and recursion. [P: 8-9] Esercizi3.pdf Prencipe
13. 9.10 11:00-13:00 C1 Exercises. Divisibility. [T: 4.1] 20171009.flv Ruggieri
14. 10.10 9:00-11:00 C1 Primes. Integer representation. [T: 4.2, 4.3, 4.5] 20171010.flv Ruggieri
15. 11.10 16:00-18:00 M-Lab Strings, tuples, lists, dictionaries, sets. [P: 10-14] 20171011.mp4 Prencipe
16. 12.10 11:00-13:00 M-Lab Exercises on strings, tuples, lists, dictionaries and sets. [P: 10-14] Esercizi4.pdf Prencipe
17. 16.10 11:00-13:00 C1 Exercises on divisibility and integer representation. Induction. [T: 5.1] 20171016.flv Ruggieri
18. 17.10 9:00-11:00 C1 Strong induction. Recursive definitions. Structural induction. [T: 5.2-5.4] 20171017.flv Ruggieri
19. 18.10 16:00-18:00 M-Lab Selection sort and Mergesort, text and binary files, exceptions, bitwise operators. [P: 15-19] 20171018.mp4 Prencipe
20. 19.10 11:00-13:00 M-Lab Debugging. Exercises on sorting, files, exceptions. [P: 15-19] Debug.pdfEsercizi5.pdf Prencipe
21. 23.10 11:00-13:00 C1 Exercises on induction and recursive programming. Basic of counting. The Pigeonhole Principle. [T: 6.1-6.2] 20171023.flv Ruggieri
22. 24.10 9:00-11:00 C1 Permutations and combinations. Binomial coefficient. Exercises on recursive programming. [T: 6.3-6.4] 20171024.flv Ruggieri
23. 25.10 16:00-18:00 M-Lab Fake exam (in preparation of Mid-Term exam). [P: 1-19] FakeMidTermExam.pdf Prencipe
24. 26.10 11:00-13:00 M-Lab In preparation of Mid-Term exam. [P: 1-19] Prencipe
25. 6.11 11:00-13:00 C1 Exercises on counting. Relations. [T: 9.1] 20171106.flv Ruggieri
26. 7.11 9:00-11:00 C1 Relations, posets. [T: 9.3, 9.4, 9.6] 20171107.flv Ruggieri
27. 8.11 16:00-18:00 M-Lab Classes, Object and Overloading. [P: 20-21] 20171108.mp4 Prencipe
28. 9.11 11:00-13:00 M-Lab Exercises on classes, objects and overloading. [P: 20-21] Esercizi6.pdf Prencipe
–. 13.11 11:00-13:00 C1 Lesson not held.
29. 14.11 9:00-11:00 C1 Architectures and hardware design. [A: 1] 20171113.pdf20171114.mp4 Prencipe
30. 15.11 16:00-18:00 M-Lab Exercise: relational operators in Python. ExRelationalOps.pdf Ruggieri
31. 16.11 11:00-13:00 M-Lab Exercise: relational operators in Python. Ruggieri
32. 20.11 11:00-13:00 C1 Exercises on relations and posets. Inclusion-exclusion. [T: 8.5,8.6] 20171120.flv Ruggieri
33. 21.11 9:00-11:00 C1 Equivalence relations. Discussion of relational operators in Python. [T: 9.5] 20171121.flv Ruggieri
34. 22.11 16:00-18:00 M-Lab Inheritance, iterators and generators, command line processing. The Unix Shell. [P: 22-24] 20171122.mp4IntroUnix.pdf Prencipe
35. 23.11 11:00-13:00 M-Lab Introduction to C: pre-processor, compiler, linker. Structure of a C-program. Exercises on Inheritance and Unix Shell. [C: 1-5] Esercizi7.pdfEsercizi8_Shell.pdf20171123.mp4 Prencipe
36. 27.11 11:00-13:00 C1 Grammars. [T: 13.1] 20171127.flv Ruggieri
37. 28.11 9:00-11:00 C1 Finite-state automata (only deterministic), regular expressions. [T: 13.3,13.4] 20171128.flv Ruggieri
38. 29.11 16:00-18:00 M-Lab Introduction to C: types, if-for-while, arrays, functions, scope. [C: 1-5] 20171129.mp4 Prencipe
39. 30.11 11:00-13:00 M-Lab Introduction to C: pointers and memory. Exercises on Python and C. [C: 1-5] Prencipe
40. 4.12 11:00-13:00 C1 Regular expressions in Python. Syntax and semantics of C expressions. [P: 25],,20171204.flv Ruggieri
41. 5.12 9:00-11:00 C1 A Python interpreter of C expressions. Type checking. Expressions.pdf,,,20171205.flv Ruggieri
42. 6.12 16:00-18:00 M-Lab Introduction to C: struct, libraries, strings [C: 1-5] Prencipe
43. 7.12 11:00-13:00 M-Lab Concepts of Operating Systems I. Exercises on Python and C. [C: 1-5] Lezione9_IntroduzioneOS.pdfLezione10_FileSystem.pdf20171207.mp4 Prencipe
–. 11.12 11:00-13:00 Lesson not held due to adverse weather conditions.
44. 12.12 9:00-11:00 C1 A Python interpreter of C commands.,Commands.pdf,20171212.flv Ruggieri
45. 13.12 16:00-18:00 M-Lab Concept of Operating Systems II. Lezione11_Periferiche.pdf20171213_1.mp4 Prencipe
46. 14.12 11:00-13:00 M-Lab Exercises. Esercizi12.pdf20171213_2.mp4 Prencipe
47. 15.12 9:00-11:00 M-Lab A Python interpreter of C commands. Wrap-up on programming languages.,20171215.flv Ruggieri
mds/pds/start.txt · Ultima modifica: 21/03/2018 alle 11:42 (4 settimane fa) da Giuseppe Prencipe