所以为了上课,我正在制作一个糟糕的文字冒险游戏。我想根据我的可接受单词词典检查用户输入的内容。但是,当我执行以下操作时,我得到一个'TypeError:'set' object is not subscriptable'。我将如何解决这个问题?
“游戏”的一小段代码:
def butts():
southLib={"long thing", "rough thing", "cylinder thing", "floor thing", "home"}
userPoop = str(input("Would you like to poop in the long thing, rough thing, cylinder thing, floor thing, or home? None?"))
while southLib[userPoop] == None:
print("I do not understand")
userPoop = str(input("Would you like to poop in the long thing, rough thing, cylinder thing, floor thing, or home? None?"))
butts()