guest = []
list = 1
while list != '0':
name = input('Enter the name of one of your guests: ')
guest.append(name)
list = input('if there are no more guests press 0, otherwise press any other key ')
print(' ')
guest.sort()
print guest
"""每当我输入用户输入时,我都会收到以下错误" name'(用户输入)'未定义。"
在搜索类似的问题时,我发现以下代码适用于其他人的机器,但它给我一个类似的错误:"""
shopList = []
maxLengthList = 6
while len(shopList) < maxLengthList:
item = input("Enter your Item to the List: ")
shopList.append(item)
print shopList
print "That's your Shopping List"
print shopList
&#34;&#34;&#34;当我在此处输入列表项时,我收到以下错误&#34; name&#39;(用户输入)&#39;没有定义。
似乎每次我使用以下语法: x =输入(&#39; blahblahblah:&#39;)
我收到此错误,据我所知,我使用了正确的语法,我无法理解此错误的含义或我收到错误的原因。非常感谢任何帮助或解释,谢谢。&#34;&#34;&#34;