-2
guys I’m reading the book fluent python And right at the beginning I come across an instruction I’ve never seen before and I can’t find any information about it. The instruction is as follows:
self.cards = [Card(rank,suit) for suit in self.suits for rank in self.ranks]
I can’t find an explanation as to why having two go in the same line and still within a list. I just need to understand this part of for the rest ta tranquil. It’s like someone give a helping hand ??
Access this link Can you do the for 1 line?
– Solkarped
https://docs.python.org/3/tutorial/datastructures.html#Tut-listcomps
– hkotsubo