🚀 If you want to join the EverythingPython Whatsapp Channel to learn something new in Python everytime I learn something, here you go - EverythingPython Channel.

⏱️ 0 min 29 sec read

List comprehension tuples and obj equals

21st Nov 2024

2 Quick TILs today -

1) You cannot use a tuple in a list comprehension without params - Alt Text

The correct syntax is [(i,j) for i in a for j in b

2) The usage of obj= within a formatted string during printing results in both the object's name as well its value separated by an "=" being printed -

In the imge below, a is a list as used earlier. Therefore -

Alt Text

3) WIP