0

だから、クラスのために私は安っぽいテキストアドベンチャーゲームを作っています. ユーザーが入力した内容を、許容できる単語の辞書と照らし合わせて確認したいと考えています。ただし、次のようにすると、「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()
4

2 に答える 2