1 回答
![?](http://img1.sycdn.imooc.com/545862e700016daa02200220-100-100.jpg)
TA贡献1789条经验 获得超10个赞
我对给定的代码片段感到困惑,但是如果我必须处理给定的代码片段并给出如上所述的输出:
def welcome_message():
first = 'Welcome to xyz'.center(30, ' ')
second = ('#' * 30).center(30, ' ')
third = 'New Game'.center(30, ' ')
fourth = 'Load Game'.center(30, ' ')
fifth = 'About'.center(30, ' ')
sixth = 'Quit Game'.center(30, ' ')
return first, second, third, fourth, fifth, sixth
def string_linesplit(arg):
for item in arg:
print(item)
def message_wrapper(foo):
print('#' * 30)
string_linesplit(foo())
print('#' * 30)
message_wrapper(welcome_message)
输出:
##############################
Welcome to xyz
##############################
New Game
Load Game
About
Quit Game
##############################
添加回答
举报