<p>我必须写一个程序,要求用户输入他们的购物清单,它应该要求他们输入他们的第一个项目,并输入'结束'当他们已经输入他们的所有项目。在</p>
<p>这是我目前为止的代码:</p>
<pre><code>#Welcome
name = input("What is your name? ")
print("Welcome %s to your shopping list" %name)
#Adding to the list
shoppingList = []
shoppingList.<a href="https://www.cnpython.com/list/append" class="inner-link">append</a> = input(print("Please enter the first item of your shopping list and type END when you have entered all of your items: "))
length = len(shoppingList)
#Output
print("Your shopping list is", length, "items long")
shoppingList.sort
print(shoppingList)
</code></pre>
<p>我不知道该怎么解决第二次加入名单的问题,你能帮忙吗?谢谢。在</p>