我只是在Python中编写一个简单的测验游戏,我想知道给出2个可能答案的方法(python 2.7),例如.(变量)answer = 'California' OR 'california'
所以变量答案可以容纳来自用户的上层或下层"C"或者答案中的更多变量.干杯
>>> 'california' in ('California', 'california')
True
Run Code Online (Sandbox Code Playgroud)
但你应该先使用.lower().
>>> 'California'.lower() in ('california', 'florida')
True
Run Code Online (Sandbox Code Playgroud)