您可以使用字典来跟踪键和值。比如说.。dictOfStuff = {} ##Make a Dictionaryx = "Buffalo" ##OR it can equal the input of something, up to you.dictOfStuff[x] = 4 ##Get the dict spot that has the same key ("name") as what X is equal to. In this case "Buffalo". and set it to 4. Or you can set it to what ever you likeprint(dictOfStuff[x]) ##print out the value of the spot in the dict that same key ("name") as the dictionary.字典和现实生活的字典非常相似。你有一个词,你有一个定义。你可以查找单词并得到定义。所以在这个例子中,你有“水牛”这个词,它的定义是4,它可以和任何其他的词和定义一起工作。先把它们放在字典里就行了。