forked from jennielees/oh-no-broken-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeyboard.py
More file actions
25 lines (19 loc) · 777 Bytes
/
keyboard.py
File metadata and controls
25 lines (19 loc) · 777 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
# I had this great script, but my keyboard broke and I can't indent
# any of my code. Can you indent it for me?
cats = ['Grizabella', 'Rum Tum Tugger', 'Demeter', 'Munkustrap',
'Mistoffelees', 'Macavity', 'Rumpleteazer', 'Mungo Jerry', 'Skimbleshanks']
instruments = ['keyboard', 'cello', 'bass', 'flute', 'pipe', 'piano',
'violin', 'oboe', 'triangle']
def get_cat_and_instrument(position):
cat = cats[position]
instrument = instruments[position]
return "{} plays the {}".format(cat, instrument)
# Print out my cat orchestra one by one
total_cats = len(cats)
position = 0
while True:
if position >= total_cats:
break
print get_cat_and_instrument(position)
position += 1
# Could you do the assignment of cats and instruments any other ways?