这是我想要做的..我希望用户选择一个数字,然后从我的列表中打印出数字索引的单词。 这就是我到目前为止所拥有的
mylist = ["john","jack","jen","judy","jill"]
mylist
add = input("please state a name")
mylist.append(add)
print (mylist)
add = input("please state a number")
答案 0 :(得分:0)
这样可行:
index = input("please state a number")
index = int(index)
name = mylist[index]
print(name)