Python: check if all array values are same I have an example array like:

array = [1, 2, 3, 4, 5, 6]


Every of this numbers refers to an object that has text property. I want to make sure that every of these object has the same text value.
Currently I do it like this:

correct = []
for number in array:
  if(object[number].text == "Sample"):
    correct.append(number)
if correct.length == array.length:
  return True


Is there a more efficient way to do this, like with lambda function or?
You are iterating over the list, and copying elements that have a certain property to the correct list, then checking whether it's of the size of the original list. In other words, you're checking whether all elements fulfill a certain condition, in other words: 

return all(object[number].text == "Sample" for number in array)