8-1 消息:
def display_message():
print("I learn function in this chapter")
display_message()
运行结果:
8-2 喜欢的图书:
def favorite_book(bookname):
print("One of my favorite books is "+bookname.title())
favorite_book("Alice in Wonderland")
运行结果:
8-3 T恤:
def make_shirt(size,word):
print("size:",size,"\nword:",word)
make_shirt(100,'good')
make_shirt(size=100,word='good')
运行结果:
8-4 大号T恤:
def make_shirt(size,word='I love Phthon'):
print("size:",size,"\nword:",word)
make_shirt('L')
make_shirt('M')
make_shirt('S',word='good')
运行结果: