-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex38.py
More file actions
24 lines (18 loc) · 680 Bytes
/
Copy pathex38.py
File metadata and controls
24 lines (18 loc) · 680 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
"""Exercise 38, Learning Python the Hard Way"""
TEN_THINGS = "Apples Oranges Crows Telephone Light Sugar"
print "Wait there's not 10 things in that list, let's fix that."
STUFF = TEN_THINGS.split(' ')
MORE_STUFF = ["Day", "Night", "Song", "Frisbee", "Corn",
"Banana", "Girl", "Boy"]
while len(STUFF) != 10:
NEXT_ONE = MORE_STUFF.pop()
print "Adding: ", NEXT_ONE
STUFF.append(NEXT_ONE)
print "There's %d items now." % len(STUFF)
print "There we go: ", STUFF
print "Let's do some things with stuff."
print STUFF[1]
print STUFF[-1] # whoa! Fancy
print STUFF.pop()
print ' '.join(STUFF) # what? cool!
print '#'.join(STUFF[3:5]) # super stellar!