-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdef_creat_dict
44 lines (32 loc) · 1.03 KB
/
def_creat_dict
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
def make_shirt(size='big', word='DEFAULT'):
print("Make shirt: ")
print("\tSize: " + size)
print("\tWord: " + word) ## IF THERE IS NO INPUT THEN WILL OUTPUT THE DEFAULT
make_shirt('big', 'I love Python')
make_shirt('big')
make_shirt('middle')
make_shirt('big', 'I love C++')
def make_album(singer, album_name, number=''):
album = {}
album['Singer'] = singer
album['Album Name'] = album_name
if number:
album['Number of songs'] = number
return album
print(make_album('JJ Lin', 'Caocao', '1'))
print(make_album('Jay Chow', 'Fantasy'))
def show_magicians(magicians):
for magician in magicians:
print(magician.title())
def make_great(magicians):
for i in range(0, len(magicians)):
magicians[i] = "Great " + magicians[i].title()
return magicians
### simple one
# for magician in magicians:
# print('Great'+ ' '+ magician.title())
magicians = ['tom', 'judy', 'bob']
great_magicians = make_great(magicians[:])
show_magicians(magicians)
print("\n")
show_magicians(great_magicians)