关于return返回值
def make_album(singer_name,album_name,song_number=""):singer_album={"singer's name":singer_name.title(),'Album_name':album_nmae.title}
if song_number:
singer_album["song numbers"] = song_number
return singer_album
singer_01 = make_album("leslie cheung", "red")
print(singer_01)
singer_02 = make_album("david bowie", "aladdin sane", 10)
print(singer_02)
singer_03 = make_album("hugh laurie", "let them talk", song_number=10)
print(singer_03)
这段代码为什么会报unindent does not match any outer indentation level 应该是缩进错误吧 wp231957 发表于 2020-10-10 22:20
应该是缩进错误吧
对的对的 我修改了之后就不报错了 但是为什么运行结果是这样
{"singer's name": 'Leslie Cheung', 'Album_name': <built-in method title of str object at 0x00000192F847CEB0>}
{"singer's name": 'David Bowie', 'Album_name': <built-in method title of str object at 0x00000192F847CF30>, 'song numbers': 10}
{"singer's name": 'Hugh Laurie', 'Album_name': <built-in method title of str object at 0x00000192F847CF70>, 'song numbers': 10} zjmm19 发表于 2020-10-10 22:22
对的对的 我修改了之后就不报错了 但是为什么运行结果是这样
{"singer's name": 'Leslie Cheung', 'Albu ...
你想要啥啥结果??
你是在>>>号下运行的吧
页:
[1]