comp-think / 2019-2020

The GitHub repository containing all the material related to the Computational Thinking and Programming course of the Digital Humanities and Digital Knowledge degree at the University of Bologna (a.a. 2019/2020).
Other
12 stars 3 forks source link

Lecture "Organising information: ordered structures", exercise 3 #14

Open essepuntato opened 4 years ago

essepuntato commented 4 years ago

Consider to have a queue obtained by processing, one by one, the elements included in the list of the first exercise, i.e. my_queue = deque(["Draco", "Harry", "Hermione", "Ron", "Severus"]). Describe the status of my_queue after the execution of each of the following operations: my_queue.popleft(), my_queue.append("Voldemort"), my_queue.popleft().

arcangelo7 commented 4 years ago
from collections import deque

my_queue = deque(["Draco", "Harry", "Hermione", "Ron", "Severus"])
my_queue.popleft()
# The queue contains 'Harry', 'Hermione', 'Ron' and 'Severus'. No 'Draco' anymore
my_queue.append("Voldemort")
# The queue contains 'Harry', 'Hermione', 'Ron', 'Severus' and 'Voldemort'. We have added 'Voldemort'
my_queue.popleft()
# The queue contains 'Hermione', 'Ron', 'Severus' and 'Voldemort'. No 'Harry' anymore
Vince2992 commented 4 years ago

Ex3

ariele-santello commented 4 years ago

Schermata 2019-10-28 alle 18 50 39

noreanystrom commented 4 years ago

image

elisasilvad commented 4 years ago

Excercise 4 3

FrancescoFernicola commented 4 years ago

ex3_28_10_2019

ariannamorettj commented 4 years ago

image

morinigiu commented 4 years ago
Schermata 2019-12-08 alle 15 08 35
giuliamanganelli commented 4 years ago

Screen Shot 2019-12-08 at 15 08 44