在命令窗口按Ctrl C,出现下面代码,应该是20行和6行有问题吧。
之后,我又重新敲了一遍,改了一些,运行通过了,但是自己也不知道上面程序错误在什么地方,改完之后代码如下
# coding=gbk
def make_great(magician_names,add_great_names):
"""对列表中的每个魔术师名字中加入‘the Great’"""
while magician_names:
current_name = magician_names.pop()
current_name = "the Great " + current_name.title()
add_great_names.append(current_name)
return add_great_names
def show_magicians(magicians_names):
"""打印出每个魔术师的名字"""
print("\nThe following magicians' name have been printed")
for magician in magicians_names:
print(magician.title())
#创建一个魔术师名字列表和空的已加字样列表
magician_names = ['yu peng','xu xinbao','wanglei']
add_great_names =[]
magician_names = make_great(magician_names,add_great_names)
show_magicians(magician_names)
希望各位路过的,帮我看看
梦里花落0921
相关分类