====== Programming for Data Science A.Y. 2019/20 ====== 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. Starting from this year, the course is **ANNUAL**: so, classes will start in September and finish in May. Hence, the first exam date for students attending the course this year for the first time will be at the end of May. =====Instructors===== * **Giuseppe Prencipe** * Università di Pisa * [[http://pages.di.unipi.it/prencipe/]] * [[giuseppe.prencipe@unipi.it]] * **Giulio Rossetti** * Università di Pisa * [[http://www.giuliorossetti.net/about/]] * [[giulio.rossetti@di.unipi.it]] =====Classes===== ^ Day of Week ^ Hour ^ Room ^ Type ^ | Thursday | 09:00 - 11:00 | Remote lecture | Remote lecture | | Friday | 09:00 - 11:00 | Remote lecture | Remote lecture | NEWS:
Google Meets link for remote lectures: Join Class.

=====Office hours===== * Prof. Prencipe: by appointment, Department of Computer Science, room 327/DO. * Prof. Rossetti: by appointment. =====Text Books===== * **[T]** Kenneth H. Rosen. //Discrete Mathematics and Its Applications//. Seventh Edition, MCGraw-Hill, 2012. [[http://highered.mheducation.com/sites/0073383090|Supplement material]] (including Errata-Corrige). * **[P]** Pieter Spronck. //The Coder’s Apprentice: Learning Programming with Python 3//, 2017. [[http://www.spronck.net/pythonbook|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. [[http://apa.di.unipi.it/pds/video/MKComputerOrganizationAndDesign-1stChapter.pdf|MKComputerOrganizationAndDesign-1stChapter.pdf]] * **[O-it]** Paolo Ancilotti, Maurelio Boari, Anna Ciampolini, Giuseppe Lipari. //Sistemi Operativi//. McGraw-Hill, 2008 * **[O-en]** Abraham Silberschatz, Peter B. Galvin, Greg Gagne. Operating System Concepts, 9th Edition International Student Version, 2013 =====Software===== * **Python programming:** [[https://www.continuum.io/downloads|Anaconda distribution of Python 3]]. Computers at lab rooms include it both on Linux and Windows OS. * **C programming (Linux):** either [[https://wiki.gnome.org/Apps/Gedit|gedit]] (or equivalent text editor) and [[https://gcc.gnu.org/|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). * **C programming (Windows)** Either DevC++ (already installed on LabMachines) or install [[https://www.cygwin.com/|CygWin]] (not on lab machines -- on your PC) or install a Virtual Machine (such us [[https://www.virtualbox.org/|VirtualBox]]) running any Linux distribution. * **Editor for C files on Windows** Either use the DevC++ editor, or use [[https://notepad-plus-plus.org/download/v7.5.2.html|Notepad++ ]]. * **Unix Shell** Either use Linux on lab machines, or install [[https://www.cygwin.com/|CygWin]] (on your PC). * **Python/C online** including visualization of memory state [[http://pythontutor.com/|PythonTutor]]. * **Jupyter Notebooks** shown during theory classes [[https://github.com/GiulioRossetti/PDS_notebooks|GitHub]] =====Preliminary program and calendar===== * [[https://esami.unipi.it/esami2/programma.php?c=39741&aa=2018|Preliminary program]]. * [[https://www.di.unipi.it/it/didattica/wds-lm/calendario-aa-2019-20-wbi|Calendar of lessons]]. =====Exams (rules valid also for COVID-19 emergency)===== Exams is made out of two parts: - Written part: solve programming exercises in both Python and C (45 minutes). If sufficient, this will give you access to the Oral part of the exam. - Oral part: discussion on both the Written part and on **ALL** of the topics covered during the course. Registration to exams is mandatory: [[https://esami.unipi.it/esami2/|register here]] Virtual room for the Written part is the same as the one used for classes. Always check [[https://esami.unipi.it/esami2/|here]] for specific information on specific sessions. IMPORTANT: **To be able to solve the C exercises during the exam, you need to use either the Linux partition or DevC++ installed in the Windows partition of the computers' lab**. Please, read **carefully** the instructions in the Software section above. ^ Day ^ Hour ^ Room ^ Type ^ | 01/06/2020 | 09:00 - | [[https://meet.google.com/rqn-hqca-zep|Virtual Room]] | I summer session | | 22/06/2020 | 09:00 - | [[https://meet.google.com/rqn-hqca-zep|Virtual Room]] | II summer session | | 13/07/2020 | 09:00 - | [[https://meet.google.com/rqn-hqca-zep|Virtual Room]] | III summer session | | 25/08/2020 | 09:00 - | [[https://meet.google.com/rqn-hqca-zep|Virtual Room]] | fall session | **Students that passed Lab exam of the 16th of June, have to sign here for the oral part:** https://agende.unipi.it/eyy-wad-pxg **Sample exam texts: [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_1.pdf|1]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_2.pdf|2]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_3.pdf|3]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_4.pdf|4]],[[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_5.pdf|5]],[[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_6.pdf|6]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_7.pdf|7]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_8.pdf|8]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_9.pdf|9]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_10.pdf|10]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_11.pdf|11]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_12.pdf|12]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_13.pdf|13]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_14.pdf|14]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_15.pdf|15]], [[http://apa.di.unipi.it/pds/esercizi/Tests/PDS_Test_16.pdf|16]], ** =====Class calendar===== Recordings of lessons are available, and are password protected. Ask the teachers for credentials. ^ ^ Day ^ Room ^ Topic ^ Learning material ^ Recordings ^ Instructor ^ |1.| 16.9 11:00-13:00 | C1 | Introduction. Propositional logic. | [**T**: 1.1-1.3] | [[http://apa.di.unipi.it/pds/video/20170918.flv|20170918.flv]][[http://apa.di.unipi.it/pds/video/20180917_en.mp4|20180917_en.mp4]] | Prencipe | |2.| 19.9 09:00-11:00 | H-Lab | Algorithms and programming: notions, programming steps, states, expressions and assignment. Introduction to Python. Data types, expressions using numbers, variables. | [**P**: 1-4] | [[http://apa.di.unipi.it/pds/video/20170920.mp4|20170920.mp4]][[http://apa.di.unipi.it/pds/video/20180920_en.mp4|20180920_en.mp4]] | Prencipe | |3.| 23.9 11:00-13:00 | C1 | Exercises. Rules of inference for propositional logic. | [**T**: 1.6] | [[http://apa.di.unipi.it/pds/video/20170919.flv|20170919.flv]][[http://apa.di.unipi.it/pds/video/20180918_en.mp4|20180918_en.mp4]] | Prencipe | |4.| 26.9 09:00-11:00 | H-Lab | Exercises and programming practice. Simple functions, input, if-else, if-elif-else. | [**P**: 1-4] | [[http://apa.di.unipi.it/pds/esercizi/Esercizi1.pdf|Esercizi1.pdf]] \\ [[http://apa.di.unipi.it/pds/video/20180926_I_en.mp4|20180926_I_en.mp4]] \\ [[http://apa.di.unipi.it/pds/video/20180926_II_en.mp4|20180926_II_en.mp4]] | Prencipe | |5.| 30.9 11:00-13:00 | C1 | while, for. | [**P**: 4-7] | [[http://apa.di.unipi.it/pds/esercizi/Esercizi2.pdf|Esercizi2.pdf]] \\ [[http://apa.di.unipi.it/pds/video/20170926.mp4|20170926.mp4]] \\ [[http://apa.di.unipi.it/pds/video/20180927_en.mp4|20180927_en.mp4]] | Prencipe | |6.| 3.10 09:00-11:00 | H-Lab | Lab exercises. | | | Prencipe | |7.| 7.10 11:00-13:00 | C1 | Functions and recursion. | [**P**: 8-9] | [[http://apa.di.unipi.it/pds/video/20171005.mp4|20171005.mp4]] \\ [[http://apa.di.unipi.it/pds/esercizi/Esercizi3.pdf|Esercizi3.pdf]] \\ [[http://apa.di.unipi.it/pds/esercizi/EserciziRecursion.pdf|EserciziRecursion.pdf]] \\ [[http://apa.di.unipi.it/pds/video/20181004_I_en.mp4|20181004_I_en.mp4]] \\ [[http://apa.di.unipi.it/pds/video/20181004_II_en.mp4|20181004_II_en.mp4]] | Prencipe | |8.| 10.10 09:00-11:00 | H-Lab | Lab exercises. | | | De Sensi | |9.| 14.10 11:00-13:00 | C1 | Strings, tuples, lists. | [**P**: 10-14] | [[http://apa.di.unipi.it/pds/video/20171011.mp4|20171011.mp4]][[http://apa.di.unipi.it/pds/video/20181010_en.mp4|20181010_en.mp4]] | Prencipe | |10.| 17.10 09:00-11:00 | H-Lab | Lab exercises. | | | Prencipe | |11.| 21.10 11:00-13:00 | C1 | Dictionaries and sets. | [**P**: 10-14] | [[http://apa.di.unipi.it/pds/esercizi/Esercizi4.pdf|Esercizi4.pdf]][[http://apa.di.unipi.it/pds/video/20181011_en.mp4|20181011_en.mp4]] | Prencipe | |12.| 24.10 09:00-11:00 | H-Lab | Lab exercises. | | | Prencipe | |13.| 28.10 11:00-13:00 | C1 | Selection sort and Mergesort, text files, exceptions. | [**P**: 15-19] | [[http://apa.di.unipi.it/pds/video/20171018.mp4|20171018.mp4]][[http://apa.di.unipi.it/pds/video/20181017_en.mp4|20181017_en.mp4]] | Prencipe | |14.| 31.10 09:00-11:00 | H-Lab | Lab exercises. | | | Prencipe | |15.| 04.11 11:00-13:00 | C1 | Binary files, bitwise operators, Debugging. | [**P**: 15-19] | [[http://apa.di.unipi.it/pds/video/20171018.mp4|20171018.mp4]] \\ [[http://apa.di.unipi.it/pds/video/20181017_en.mp4|20181017_en.mp4]] \\ [[http://apa.di.unipi.it/pds/esercizi/Debug.pdf|Debug.pdf]] \\ [[http://apa.di.unipi.it/pds/esercizi/Esercizi5.pdf|Esercizi5.pdf]] \\ [[http://apa.di.unipi.it/pds/video/20181018_en.mp4|20181018_en.mp4]] | Prencipe | |16.| 07.11 09:00-11:00 | H-Lab | Test. | | | Prencipe | |17.| 11.11 11:00-13:00 | C1 | Classes, Object and Overloading. | [**P**: 20-21] | [[http://apa.di.unipi.it/pds/video/20171108.mp4|20171108.mp4]][[http://apa.di.unipi.it/pds/video/20181024_en.mp4|20181024_en.mp4]] | Prencipe | |18.| 14.11 09:00-11:00 | H-Lab | Lab Exercises. | | | Rossetti | |19.| 18.11 11:00-12:00 | C1 | Lesson not held (city closed - flooding). | | | - | |20.| 21.11 09:00-11:00 | H-Lab | Lab Exercises. | | | Prencipe | |21.| 25.11 11:00-13:00 | C1 | First Order Logic: Predicates and Quantifiers, Rules of Inference | [**T**: 1.4-1.6] | [[http://apa.di.unipi.it/pds/video/20180924_en.m4v|20180924_en.m4v]] | Rossetti | |22.| 28.11 09:00-11:00 | H-Lab | Lab Exercises. | | | Prencipe | |23.| 02.12 11:00-13:00 | C1 | Sets and Set Operations | [**T**: 2.1-2.2] | [[http://apa.di.unipi.it/pds/video/20180925_en.m4v|20180925_en.m4v]] | Rossetti | |24.| 05.12 09:00-11:00 | H-Lab | Lab Exercises. | | [[http://apa.di.unipi.it/pds/esercizi/Esercizi6.pdf|Esercizi6.pdf]] | Prencipe | |25.| 09.12 11:00-13:00 | C1 | Inheritance, iterators and generators, command line processing. | [**P**: 22-24] | [[http://apa.di.unipi.it/pds/esercizi/Esercizi7.pdf|Esercizi7.pdf]] \\ [[http://apa.di.unipi.it/pds/video/20171122.mp4|20171122.mp4]] \\ [[http://apa.di.unipi.it/pds/video/20181025_en.mp4|20181025_en.mp4]] | Prencipe | |26.| 12.12 09:00-11:00 | H-Lab | Lab Exercises. | | [[http://apa.di.unipi.it/pds/esercizi/Esercizi13-Classi.pdf|Esercizi13-Classi.pdf]][[http://apa.di.unipi.it/pds/esercizi/Esercizi13-Classi-SketchOfSolutions.zip|Esercizi13-Classi-SketchOfSolutions.zip]] | Prencipe | |27.| 27.02 09:00-11:00 | L1 | Exercises on Predicate Logic and Sets | | [[http://apa.di.unipi.it/pds/video/20181008_en.m4v|20181008_en.m4v]] | Rossetti | |28.| 28.20 9:00-11:00 | L1 | Functions, Sequences, Set Cardinality, Matrices | [**T**: 2.3-2.6] | [[http://apa.di.unipi.it/pds/video/20181009_en.m4v|20181009_en.m4v]] | Rossetti | |29.| 12.03 9:00-11:00 | Google Meet | Exercises on Functions, Sequences, Set Cardinality. High Order Functions. | | [[http://apa.di.unipi.it/pds/video/20181015_en.m4v|20181015_en.m4v]] | Rossetti | |30.| 13.03 9:00-11:00 | Google Meet | Divisibility. Primes. Integer Representation. | [**T**: 4.1, 4.2, 4.3, 4.5] | [[http://apa.di.unipi.it/pds/video/20181016_en.m4v|20181016_en.m4v]] | Rossetti | |31.| 19.03 9:00-11:00 | Google Meet | Exercises on Primes, Integer Representation, Divisibility. Induction. | [**T**: 5.1] | [[http://apa.di.unipi.it/pds/video/20181022_en.m4v|20181022_en.m4v]] | Rossetti | |32.| 20.03 9:00-11:00 | Google Meet | Strong Induction, Recursion, Structural Induction. | [**T**: 5.2, 5.3, 5.4] | [[http://apa.di.unipi.it/pds/video/20181023_en.m4v|20181023_en.m4v]] | Rossetti | |33.| 26.03 9:00-11:00 | Google Meet |Basic of counting: The Pigeonhole Principle, Permutations, Combinations, Binomial coefficient. | [**T**: 6.1, 6.2, 6.3, 6.4] | [[http://apa.di.unipi.it/pds/video/20181105_en.m4v|20181105_en.m4v]] | Rossetti | |34.| 27.03 9:00-11:00 | Google Meet | Exercises on induction and recursive programming. | | [[http://apa.di.unipi.it/pds/video/20181106_en.m4v|20181106_en.m4v]] | Rossetti | |35.| 02.04 9:00-11:00 | Google Meet | The Unix Shell. Introduction to C: pre-processor, compiler, linker. Structure of a C-program.| [**P**: 22-24][**C**: 1-5] | [[http://apa.di.unipi.it/pds/video/Lezione8_IntroUnix.pdf|IntroUnix.pdf]] \\ [[http://apa.di.unipi.it/pds/video/introUnix_en.pdf|introUnix_en.pdf]] \\ [[http://apa.di.unipi.it/pds/esercizi/introUnixSoloEsercizi_en.pdf|8-ShellEx_en.pdf]] \\ [[http://apa.di.unipi.it/pds/video/2020-04-02-CLanguage-1.mp4|CLanguage-1.mp4]] | Prencipe | |36.| 03.04 9:00-11:00 | Google Meet | Introduction to C: pre-processor, compiler, linker. Structure of a C-program, types, if-for, switch. | [**C**: 1-5] | [[http://apa.di.unipi.it/pds/video/lect2-introC-slides_en.pdf|intro-C_en.pdf]][[http://apa.di.unipi.it/pds/esercizi/Esercizi9_introC1_en.pdf|9.1-Cex_en.pdf]] \\ [[http://apa.di.unipi.it/pds/esercizi/Esercizi9_C2_en.pdf|9.2-Cex_en.pdf]] \\ [[http://apa.di.unipi.it/pds/video/20181108_en.mp4|20181108_en.mp4]] \\ [[http://apa.di.unipi.it/pds/video/2020-04-03-CLanguage-2.mp4|CLanguage-2.mp4]] | Prencipe | |37.| 09.04 09:00-11:00 | Google Meet | Introduction to C: arrays, functions, scope, pointers and memory. | [**C**: 1-5] | [[http://apa.di.unipi.it/pds/video/20171129.mp4|20171129.mp4]] \\ [[http://apa.di.unipi.it/pds/video/20181114_en.mp4|20181114_en.mp4]] \\ [[http://apa.di.unipi.it/pds/video/20171130.mp4|20171130.mp4]] \\ [[http://apa.di.unipi.it/pds/video/20181115_en.mp4|20181115_en.mp4]] \\ [[http://apa.di.unipi.it/pds/video/2020-04-09-CLanguage-3.mp4|CLanguage-3.mp4]] \\ [[http://apa.di.unipi.it/pds/esercizi/Esercizi9_introC_en.zip|Esercizi9_introC_en.zip]] | Prencipe | |38.| 16.04 09:00-11:00 | Google Meet | Introduction to C: dangling pointers, memory leaks, struct, lists. | [**C**: 6] | [[http://apa.di.unipi.it/pds/video/20181122_en.mp4|20181122_en.mp4]] \\ [[http://apa.di.unipi.it/pds/video/20171206.mp4|20171206.mp4]] \\ [[http://apa.di.unipi.it/pds/video/20181128_en.mp4|20181128_en.mp4]] \\ [[http://apa.di.unipi.it/pds/video/2020-04-09-CLanguage-4.mp4|CLanguage-4.mp4]] \\ [[http://apa.di.unipi.it/pds/esercizi/Esercizi10_en.zip|Esercizi10_en.zip]] | Prencipe | |39.| 17.04 09:00-11:00 | Goole Meet | Relations, poset. | [**T**: 9.1, 9.3, 9.4, 9.6] | [[http://apa.di.unipi.it/pds/video/20181112_en.m4v|20181112_en.m4v]] \\ [[http://apa.di.unipi.it/pds/video/20181113_en.m4v|20181113_en.m4v]] | Rossetti | |40.| 23.04 09:00-11:00 | Goole Meet | Inclusion-exclusion. Equivalence relations. | [**T**: 8.5,8.6] | [[http://apa.di.unipi.it/pds/video/20181119_en.m4v|20181119_en.m4v]] | Rossetti | |41.| 24.04 09:00-11:00 | Goole Meet | Exercises on relations and posets. Relational operators in Python. | [**T**: 9.5] | [[http://apa.di.unipi.it/pds/video/20181121_en.m4v|20181121_en.m4v]] | Rossetti | |42.| 30.04 09:00-11:00 | Goole Meet | Grammars. | [**T**: 13.1] | [[http://apa.di.unipi.it/pds/video/20181126_en.m4v|20181126_en.m4v]] | Rossetti | |43.| 14.05 09:00-11:00 | Goole Meet | Introduction to C: libraries, strings | [**C**: 1-6] | [[http://apa.di.unipi.it/pds/video/20181129_en.mp4|20181129_en.mp4]] \\ [[http://apa.di.unipi.it/pds/video/2020-05-14-CLanguage-5.mp4|CLanguage-5]] | Prencipe | **2018-2019** ^ ^ Day ^ Room ^ Topic ^ Learning material ^ Recordings ^ Instructor ^ |3.| 19.9 16:00-18:00 | M-Lab | Architectures and hardware design. | [**A**: 1] | [[http://apa.di.unipi.it/pds/video/20171113.pdf|20171113.pdf]][[http://apa.di.unipi.it/pds/video/20171114.mp4|20171114.mp4]][[http://apa.di.unipi.it/pds/video/20180919_en.mp4|20180919_en.mp4]] | Prencipe | |6.| 03.10 09:00-11:00 | H-Lab | Concepts of Operating Systems I. | | [[http://apa.di.unipi.it/pds/esercizi/Lezione9_IntroduzioneOS.pdf|Lezione9_IntroduzioneOS.pdf]][[http://apa.di.unipi.it/pds/esercizi/Lezione10_FileSystem.pdf|Lezione10_FileSystem.pdf]][[http://apa.di.unipi.it/pds/video/20171207.mp4|20171207.mp4]] | Prencipe | |9.1| 01.10 11:00-13:00 | C1 | Concepts of Operating Systems I. | | [[http://apa.di.unipi.it/pds/video/Lezione9_IntroduzioneOS_en.pdf|Lezione9_IntroduzioneOS_en.pdf]][[http://apa.di.unipi.it/pds/video/Lezione10_FileSystem_en.pdf|Lezione10_FileSystem_en.pdf]][[http://apa.di.unipi.it/pds/video/20181001_en.mp4|20181001_en.mp4]] | Prencipe | |--.| 02.10 09:00-11:00 | | Lesson not held. | | |10| 03.10 16:00-18:00 | M-Lab | Concepts of Operating Systems II. | | [[http://apa.di.unipi.it/pds/video/20181003_I_en.mp4|20181001_I_en.mp4]][[http://apa.di.unipi.it/pds/video/20181003_II_en.mp4|20181001_II_en.mp4]] | Prencipe | |36.| 27.11 11:00-13:00 | N1 | Finite-state automata, regular expressions. | [**T**: 13.3, 13.4] | [[http://apa.di.unipi.it/pds/video/20181127_en.m4v|20181127_en.m4v]] | Rossetti | |39.| 03.12 11:00-13:00 | C1 | Regular expressions in Python. Syntax and semantics of C expressions. | [**P**: 25] | | Rossetti | |40.| 04.12 11:00-13:00 | N1 | A Python interpreter of C expressions. Type checking. | | | Rossetti | |41.| 05.12 16:00-18:00 | M-Lab | Fake Test | | [[http://apa.di.unipi.it/pds/esercizi/20181205-FakeTest.pdf|20181205-FakeTest.pdf]][[http://apa.di.unipi.it/pds/esercizi/20181205-FakeTest_Soluzione.pdf|20181205-FakeTestSoluzione.pdf]] | Prencipe | |43.| 10.12 11:00-13:00 | C1 | A Python interpreter of C commands. | | | Rossetti | |44.| 11.12 11:00-13:00 | N1 | A Python interpreter of C commands. Wrap-up on programming languages. | | | Rossetti | =====Previous years===== * [[mds:pds:2018|Programming s for Data Science A.Y. 2018/19]]