高级编程技术第四周平时作业(2)
8-1 消息:
def display_message():
"""打印本章学什么"""
print("本章学的是函数。")
display_message()
8-2 喜欢的图书:
def favorite_book(title):
print("One of my favorite books is " + title)
favorite_book("Python")
8-4 大号T恤:
def make_shirt(size, msg="I love Python"):
print("尺寸:" + size)
print("印的字样:" + msg)
make_shirt('大')
make_shirt('中')
make_shirt('小', 'I love C++')
8-6 城市名:
def city_country(city, country):
return city + ', ' + country
print(city_country('Guangzhou', 'China'))
print(city_country('New York', 'America'))
print(city_country('London', 'England'))
8-9 魔术师:
def show_magicians(names):
for name in names:
print(name)
names = ['Jerry', 'Tom', 'Mary', 'Kiko']
show_magicians(names)
8-15 打印模型
In printing_functions.py:
def print_models(**models_infor):
for key, value in models_infor.items():
print(key + ':' + value)
In main.py:
import printing_functions as p
p.print_models(name='Tom', location='gz', tel='0000000')