练习8-9:消息 创建一个列表,其中包含一系列简短的文本消息。将该列表
传递给一个名为show_messages() 的函数,这个函数会打印列表中的每条文
本消息。
message_list = ['hello', 'nihao', 'someday']
def show_massages(message_list):
for message in message_list:
print(message)
show_massages(message_list)
hello
nihao
someday
进程已结束,退出代码0
消息列表展示
本文介绍了一个简单的Python函数show_messages(),该函数接收一个包含文本消息的列表,并依次打印出列表中的每一条消息。示例中使用了包含'hello'、'nihao'、'someday'的消息列表。
1039

被折叠的 条评论
为什么被折叠?



