任何人都可以帮忙吗?我需要得到这个工作,但它不会,我已经适当地犯了一个简单的错误,但我无法发现它。 (忽略拼写错误)国家阵列任务
countries = ["Spain","England","Scotland","USA","Wales","Ireland","France",
"Greece","China","Japan"]
print("1. Add a new country")
print("2. Delete a country")
print("3. Sort the countries")
choice = int(input("Select the option you require"))
if choice == 1:
newcount = input("Enter a country to be added to the list:")
countries.append(newcount)
print("Your countires are now:",countries)
if choice == 2:
deletec = input("Enter a country to be deleted:")
countries.pop(deletec)
print("Your countires are now",countries)
if choice == 3:
countries.sort
print("Your countries are now",countries)
你缺少'countries.sort'括号,和你的'pop'调用不正确。 –
请在提问时更具体。不要说明,该代码不起作用,请写下它的工作原理。这段代码应该做什么?它做什么呢?什么是错误信息? –