Unit 2 - Log of the lectures

angelo.spognardi (4680 points)
37 62 96
asked Sep 29, 2021 in Course info by angelo.spognardi (4,680 points)
edited Dec 17, 2021 by angelo.spognardi

Unit 2

Sep 29th: Introduction to programming, algorithms, think and express and algorithm, first steps with python.

Oct 1st: python terminal, differences between binary and text files, bits and bytes/hex digits representations, encoding (one-to-one mapping), int and float types (sketch)

Oct 6th: modeling problems with graphs (Königsberg's bridges, traveling salesman problem), int, float, strings, functions, print, input

Oct 8th: importing modules, variables in function scope, if statement and importance of the indentation, exercises.

Oct 13th: exercise solutions and discussion, max function, or and and operators oddities, tuples, lists, sort/sorted, reverse/reversed, list element selection, and slicing, addition (append/insert) and removal (del/pop).

Oct 15th: lists, tuples, strings, for and while loops, exercises.

Oct 20th: first optional HW assignment, for on lists and strings. Looping with the position of the elements (indexes with range function) or with the elements.

Oct 22th: structure of a program, counting the elements of a list, efficiency of solutions.

Oct 27th: HW assignment 2, dictionaries, list sorting, introduction to lambda functions.

Nov 3rd: dictionaries, sorting, file operations

Nov 5th: dictionaries, sorting functions (lambda), file operations, json files

Nov 10th: sorting functions, file reading, and writing, removing elements from a list while scanning, dictionaries of dictionaries (nested dictionaries)

Nov 12th: HW2-req solutions overview and discussion, HW4-req description and discussion, introduction to matrices as lists of lists (nested lists)

Nov 17th: working with nested lists, matrices and images.

Nov 19th: working with nested lists, images.

Nov 24th: HW-req description and discussion, images and classes.

Nov 26th: images (follow the line, iterative/recursive), classes (matrix)

Dec 1st: image ex15, recursion

Dec 3rd: permutations, recursion on lists, trees, binary trees implemented via the BNode class

Dec 10th: HW8-req, review of binary trees, n-ary trees.

Dec 15th: HW8-req, exam simulation

Dec 17th: HW8-req, small recap about slicing, dictionaries, exercises with sets, lists, strings and os library


3 Answers

Quellocinese (2700 points)
2 4 22
answered Sep 30, 2021 by Quellocinese (2,700 points)
the first lesson was great!!
Luigi Pizza (6120 points)
11 20 65
answered Sep 30, 2021 by Luigi Pizza (6,120 points)
edited Oct 13, 2021 by Luigi Pizza

As I have also commented under the Post "Video Recordings", a part of the lecture of Sep 29th has been lost due to the separation into breakout rooms. In particular the part that has been lost regarded:

  • 2 exercises: 

    • 6 Marbles Problem (you have six marbles of which one is heavier and you want to find it using a double-plate weight scale only twice)

    • Sorting Algorithm (you have 10 random numbers and you want to sort them in increasing order)

  • usage of the terminal: dir, cd, touch(Only OS Unix/Unix-like), cat > (Only OS Unix/Unix-like), copy, move, python3

Apart from touch and cat >, all the other commands work on Windows. 

If you have Windows as your OS, you can open the terminal with (Win+R -> cmd.exe) and write the commands with the following syntax to learn what they are about:

command /?

It should look Something like this:

C:\Users\user>move /?

(Obviously you can change directory however you want)

TAREQ ALOME (230 points)
1 2 4
commented Oct 12, 2021 by TAREQ ALOME (230 points)
Can you please tell me from where i can have the video of the classes
Ciampricotti (900 points)
3 6 9
commented Oct 12, 2021 by Ciampricotti (900 points)
Hi! You can see the recordings of the lessons here: https://q2a.di.uniroma1.it/21945/video-recordings#
Carlotta Murri (800 points)
0 0 6
answered Oct 12, 2021 by Carlotta Murri (800 points)
will we be going over these exercises in class?

It would be really helpful to understand the tricky sections