乡村数组

2024-04-25 01:56:17 发布

您现在位置:Python中文网/ 问答频道 /正文

有人能帮忙吗?我需要让这个工作,但它不会,我已经适当地做了一个简单的错误,但我不能发现它。(忽略拼写错误)

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)

Tags: thetoinputyourifbecountrycountries