-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_exercise_page25.py
More file actions
54 lines (30 loc) · 969 Bytes
/
python_exercise_page25.py
File metadata and controls
54 lines (30 loc) · 969 Bytes
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
# esercizio numero 2.3 pagina 25
name = "lorenzo"
msg = f"Hello {name.title()}, would you like to learn some Python today?"
print(msg)
# esercizio numero 2.4
name = "lorenzo"
print(name.lower())
print(name.upper())
print(name.title())
# esercizio numero 2.5
print('Albert Einstein once said, "A person who never made a mistake')
print('never tried anything new."')
# esercizio numero 2.6
famous_person = "Albert Einstein"
message = f'{famous_person} once said, "A person who never made a mistake never tried anything new."'
print(message)
# esercizio numero 2.7
name = "\tLorenzo Bradanini\n"
print("Unmodified:")
print(name)
print("\nUsing lstrip():")
print(name.lstrip())
print("\nUsing rstrip():")
print(name.rstrip())
print("\nUsing strip():")
print(name.strip())
# esercizio numero 2.8
filename = 'python_notes.txt'
simple_filename = filename.removesuffix('.txt')
print(simple_filename)