高级编程作业第8章

homework_7.py

#8.2
def f_book(book):
	print("My favorite book is "+book.title())
f_book("Wind rahame")
#8.4
def m_shirt(si,word='I Love Python'):
	print("This shirt is "+si+" size, and be printed with '"+word+"'")
m_shirt("L")
m_shirt("M")
m_shirt("XXL","I'm fat")
#8.7
def m_album(s_name,a_name):
	album = {"Signer":s_name,"Album":a_name}
	return album
n_album = m_album('Lamar','DAMN.')
print(n_album)
n_album = m_album('Maroon 5','Croed Pleasers')
print(n_album)
n_album = m_album(a_name='Issa Album',s_name='21 Savage')
print(n_album)
#8.8
while True:
	signer = input("Input the signer's name or input 'q' to quit ")
	if(signer == 'q'):
		break
	album = input("Input the album's name ")
	n_album = m_album(signer,album)
	print(n_album)
#8.9
magics = ['Lu Benwei','Van','Bili','Xiaoming']
def s_magic(mag):
	for magic in mag:
		print(magic)
	print('\n')
s_magic(magics)
#8.11
def m_great(mag):
	num = 0
	length = len(mag)
	while num < length:
		mag[num] = 'the Great '+mag[num]
		num += 1
	return mag

#m_great(magics)
#s_magic(magics)
_magics = m_great(magics[:])
s_magic(magics)
s_magic(_magics)
#8.12
def make_car(manu,model,**info):
	cars = {}
	cars['manufacturer'] = manu
	cars['model'] = model
	for key,value in info.items():
		cars[key] = value
	return cars

car = make_car('subaru','outback',color = 'blue',toe_package = True)
print(car)
homework_7_1.py
#8.15
import homework_7_2 as pri

phones = ['Apple','Sumsung','Huawei']
pri.p_print(phones)

homework_7_2.py

#8.15
def p_print(phones):
	print('\n')
	for phone in phones:
		print(phone)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值