List Comprehensions in Python is an interesting one. I absolutely love them in some cases, and despise them on others.
# Simple and elegant...
squares=[n**2forninnumbers]list_a=[...]list_b=[...]# ...not on this one IMO, I'd prefer loops instead.
different_num=[(a,b)forainlist_aforbinlist_bifa!=b]
List Comprehensions in Python is an interesting one. I absolutely love them in some cases, and despise them on others.
It's my first time to see such syntax since I haven't really touched Python. Looks interesting , I couldn't understand what the last line does though.
The last line is: