-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpanic.py
More file actions
23 lines (19 loc) · 386 Bytes
/
Copy pathpanic.py
File metadata and controls
23 lines (19 loc) · 386 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
Book Head First Python, chapter 2, example, page 67
@author: Tiago
@date: Jan 24
"""
phrase = "Don't panic!"
plist = list(phrase)
print(phrase)
print(plist)
for letter in plist:
if letter not in "on tap":
plist.remove(letter)
plist.pop()
plist.pop()
plist.insert(2, plist.pop(3))
plist.insert(4, plist.pop(5))
new_phrase = ''.join(plist)
print(plist)
print(new_phrase)