【发布时间】:2020-12-02 18:20:32
【问题描述】:
我想比较一个字符串和一个列表,但是我的代码不起作用
def compare(typeOfColors):
introduceC = input("Introduce a color")
while(introduceC.lower() != typeOfColors)
print("Error")
colors = ["white", "black"]
compare(colors)
【问题讨论】:
-
introduceC.lower() in typeOfColors足以知道输入字符串的低版本是否存在于列表中
标签: python string list function compare