2 ответов
+ 3
list1 = [1,2,3,1]
print(list1[0]==list1[1])
#returns false
print(list1[0]==list1[3])
#returns true
+ 1
def compare(lst,idx1,idx2):
return lst[idx1] == lst[idx2]
# when you don’t know the index, you can use an iterator. (e.g. itertools module)