我在 python 中打印列表时遇到问题,因为每当我发出显示列表的命令时,它都不会显示该列表。以下是列表所在的整个函数引用的代码:
#FUNCTIONS
def help():
print("list of commands\n"
+ "help = Display of commands\n"
+ "list = list of all the Latin I vocabulary\n"
+ "Quit = exits the main program to the exit credits and then exits the app\n")
def userInstructions(userInput):
if (userInput == "help" or "Help"):
help()
elif(userInput == "list" or "List"):
list()
return input("\nEnter your responce: ")
def list():
a = ["salve" , "vale" , "et" , "est" , "in" , "sunt" , "non" , "insula" , "sed" , "oppidum"
, "quoque" , "canis" , "coquus" , "filia" , "filius" , "hortus" , "mater" , "pater" , "servus" , "via" , "amicus" , "ancilla" , "cena" , "cibus"
, "intro" , "saluto" , "porto" , "video" , "dominus" , "laetus" , "mercator" , "audio" , "dico" , "unus" , "duo" , "tres" , "quattuor" , "quinque"
, "sex" , "septem" , "octo" , "novem" , "decem" , "ad" , "ecce" , "magnus" , "parvus" , "ambulo" , "iratus" , "quis" , "quid" , "cur" , "ubi" ,
"sum" , "es" , "eheu" , "pecunia" , "ego" , "tu" , "habeo" , "respondeo" , "venio" , "rideo" , "quod" , "ex" , "voco" , "clamo" , "specto" , "taberna"
, "laboro" , "clamor" , "femina" , "vir", "puer" , "puella" , "multus" , "urbs" , "agricola" , "curro" , "hodie" , "iuvenis" , "meus" , "senex" , "sto" ,
"optimus" , "volo" , "fortis" , "emo" , "pulso" , "bonus" , "malus" , "festino" , "per" , "pugno" , "scribo" , "tuus" , "erat" , "paro" , "cum" , "facio" ,
"heri" , "ingens" , "nihil" , "omnis" , "vendo" , "navis" , "prope" , "rogo" , "terreo" , "inquit" , "tamen" , "eum" , "eam" , "duco" , "saepe" , "interficio" ,
"habito" , "silva" , "statim" , "totus" , "pessimus"]
print("List:")
print('\n'.join(map(str, a)))
下图显示了当我命令代码打印列表而不是打印列表时的结果,而是打印帮助面板:
我的代码有什么问题,我该如何解决?