You can just check if "city" variable is at the last index of the array and break accordingly ie. if all elements are unique.
otherwise you can keep track of the current index and increment it everytime after the selenium code, once it becomes len(cities)-1 you can break the loop.