#8.1
def display_message():
print("what we learn in this chapter is the function")
display_message()
#8.5
def describe_city(cityname,citybelong = 'China'):
print(cityname + ' is in ' + citybelong)
describe_city('Beijing')
describe_city('shanghai')
describe_city('Tokyo','japan')
#8.10
names = ['harvey','frank','alice','bob']
def show_magicians(names):
for name in names:
print (name)
show_magicians(names)
def make_great(names):
i= 0
for name in names:
names[i] = name + "the great"
i += 1
make_great(names)
show_magicians(names)
#8.13
def build_profile(first, last, **user_info):
profile = {}
profile['first_name'] = first
profile['last_name'] = last
for key, value in user_info.items():
profile[key] = value
return profile
user_profile = build_profile('albert', 'einstein',
location = 'princeton',
field='physics')
print(user_profile)
my_profile = build_profile('Remilia', 'Scarlet',
location = 'Koumakan',
field = 'destiny',
drink = 'tea'
)
print(my_profile)
#8.1def display_message(): print("what we learn in this chapter is the function")display_message()#8.5def describe_city(cityname,citybelong = 'China'): print(cityname + ' is in ' + citybelong)...