当所有列表中存在(至少1个)和最喜欢的乐队(可能> 3)时,我必须创建一个列表清单的代码,其中它返回“True”。我对编程非常陌生,而且我很遗憾要做什么。我尝试了一些东西,但没有完全填充,我需要一些帮助!Python-列表列表
favoriteBandLists = [
["Metallica","Linkin Park","Alice In Chains","Nirvana", "Soundgarden"],
["Pink Floyd","Alice In Chains","Soundgarden","Metallica","Linkin Park"],
["Audioslave","Offspring","Soundgarden","Linkin Park","The Beatles"]]
我的代码:
def commonFavoriteBand(list):
foundCounterExampleyet = False
for i in range(()):
if(()):
foundCounterExampleYet = True
return not(foundCounterExampleYet)
print (commonFavoriteBand())
def commonFavoriteBandA():
foundExampleYet = False
for value in values:
if():
foundExampleYet = True
return foundExampleYet
你能仔细检查你的发布代码的缩进吗?很难看到那里发生了什么.. – msturdy 2014-12-11 03:11:47
@msturdy是否有缩进的具体方法?我很抱歉我在这里有一种新的 – 2014-12-11 03:18:16
复制你的代码到框中,选择它,然后按Ctrl + k – msturdy 2014-12-11 03:21:40