-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_exercise_page45.py
More file actions
81 lines (53 loc) · 1.86 KB
/
python_exercise_page45.py
File metadata and controls
81 lines (53 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#esercizio numero 3.8 pagina 45
places = ['iceland', 'norway', 'sweden', 'belgium', 'portugal']
print(places)
places = ['iceland', 'norway', 'sweden', 'belgium', 'portugal']
print("\nHere is the original sorted list of places:")
print(sorted(places))
places = ['iceland', 'norway', 'sweden', 'belgium', 'portugal']
print("\nHere is the original list of places, again:")
print(places)
places = ['iceland','norway', 'sweden', 'belgium', 'portugal']
places.sort(reverse=True)
print(places)
places = ['iceland', 'norway', 'sweden', 'belgium', 'portugal']
print("\nHere is the original list of places, again:")
print(places)
places = ['iceland', 'norway', 'sweden', 'belgium', 'portugal']
print(places)
places.reverse()
print(places)
places.reverse()
print(places)
places = ['iceland', 'norway', 'sweden', 'belgium', 'portugal']
places.sort()
print(places)
places.sort(reverse=True)
print(places)
#esercizio numero 3.9
dinner = ['Ilaria', 'Lorenzo']
invite = dinner.pop(0)
print(f"You are still invited to dinner, {invite.title()}.")
invite = dinner.pop(-1)
print(f"You are still invited to dinner, {invite.title()}.")
dinner = ['Ilaria', 'Lorenzo']
dinner.remove('Lorenzo')
print(dinner)
dinner.remove('Ilaria')
print(dinner)
print(len(dinner))
#esercizio numero 3.10
list = ['monte rosa', 'monte bianco', 'monte bernina', 'monte cevedale', 'monte cervino']
print(list)
print(len(list))
list.sort()
print(list)
list = ['monte rosa', 'monte bianco', 'monte bernina', 'monte cevedale', 'monte cervino']
list.reverse()
print(list)
list = ['monte rosa', 'monte bianco', 'monte bernina', 'monte cevedale', 'monte cervino']
list.sort(reverse=True)
print(list)
list = ['monte rosa', 'monte bianco', 'monte bernina', 'monte cevedale', 'monte cervino']
print("\nHere is the sorted list")
print(sorted(list))