for x in no_dupes: #looks at tuple in list
if x != totallist[x]: #checks when a tuple in no_dupes is not in totallist
return "The graph violates the STC" #ends the function, because as soon as one tuple in no_dupes isn't in totallist, the graph violats the STC.
我想将一个列表(在list no_dupes中)中的所有元组与另一个列表(totallist)进行比较,以查看在totallist中,一个list的元组是否not。在
这就是没有傻瓜的样子
这就是全面主义者的样子
错误是什么样子的
如何解决这个错误?在
这个错误是由这样一个事实引起的,即x是一个元组,并且不能将一个元组用作totalist的索引。必须是整数。在
如果通过循环遍历两个列表直接比较元组,则可以避免此问题。在
在这个例子中,输出是
^{pr2}$相关问题 更多 >
编程相关推荐