当我尝试打印一个str和len()时,不断收到SyntaxError。请指教
companies = [['Google', 'Facebook', 'Apple'],
['Warner Bros. Pictures', '20th Century Fox', 'Universal Pictures'],
['Whole foods', 'Starbucks', 'Walmart']]
for x in range(len(companies)):
for y in range(len(companies[x])):
print("This company name has length of:" + " " + str(len(companies[x][y]))
答案 0 :(得分:0)
您只是错过了一个右括号
companies = [['Google', 'Facebook', 'Apple'],
['Warner Bros. Pictures', '20th Century Fox', 'Universal Pictures'],
['Whole foods', 'Starbucks', 'Walmart']]
for x in range(len(companies)):
for y in range(len(companies[x])):
print("This company name has length of:" + " " + str(len(companies[x][y])))