-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_exercise_page98.py
More file actions
64 lines (43 loc) · 1.51 KB
/
python_exercise_page98.py
File metadata and controls
64 lines (43 loc) · 1.51 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
#esercizio numero 6.1 pagina 98
person_0 = {'first_name': 'Samuele', 'last_name': 'Bradanini', 'age': '19 years old', 'city': 'Villa Guardia'}
print(person_0)
#esercizio numero 6.2
favorite_numbers = {
'lorenzo': '1',
'Sara': '24',
'Andrea': '36',
'Giovanni': '4',
'Davide': '89',
}
number = favorite_numbers['lorenzo'].title()
print(f"Lorenzo's favorite number is {number}.")
number = favorite_numbers['Sara'].title()
print(f" Sara's favorite number is {number}.")
number = favorite_numbers['Andrea'].title()
print(f"Andrea's favorite number is {number}.")
number = favorite_numbers['Giovanni'].title()
print(f"Giovanni's favorite number is {number}.")
number = favorite_numbers['Davide'].title()
print(f"Davide's favorite number is {number}.")
#esercizio numero 6.3
glossary = {
'Python': 'language',
'Dictionary': 'collection of key-value pairs',
'Variables': 'value that can change',
'List': 'sequence of variables',
'Sorting': 'displacing a list in a particular order',
}
gloss = glossary['Python'].title()
print(f"Python is a {gloss.lower()}.")
print("\n")
gloss = glossary['Dictionary'].title()
print(f"A Dictionary is a {gloss.lower()}.")
print("\n")
gloss = glossary['Variables'].title()
print(f"Variables are {gloss.lower()}.")
print("\n")
gloss = glossary['List'].title()
print(f"A List is a {gloss.lower()}.")
print("\n")
gloss = glossary['Sorting'].title()
print(f"Sorting is basically {gloss.lower()}.")