Is the order of results coming from a list comprehension guaranteed?

Yes, the list comprehension preserves the order of the original iterable (if there is one).
If the original iterable is ordered (list, tuple, file, etc.), that’s the order you’ll get in the result. If your iterable is unordered (set, dict, etc.), there are no guarantees about the order of the items.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)