我需要帮助,使验证功能,以帮助我得到一个错误输出时,用户输入重复
这只是我正在做的代码的一部分,我只需要帮助创建一个验证函数
Color_ID_List=[]
maxColorList=15
while len(Color_ID_List)<maxColorList:
b=input("Enter New color: ")
c=int(input("Enter ID: "))
d=input("Enter type of color: ")
print("The ID of", b, "is", c,"and the type of color is",d)
Color_ID_List.append(b)
Color_ID_List.append(c)
Color_ID_List.append(d)
print("")
print("")
print("The following colors and ID has been added")
print(Color_ID_List)
尝试使用
in
语句。这看起来像这样:当此函数返回
True
时,输入已经在列表中相关问题 更多 >
编程相关推荐