Hexx's Study Notes

This repository displays my personal study notes across various tech subjects, showcasing my continuous learning and expertise in all things related to computer science.

View the Project on GitHub HexxKing/hexxs_study_notes

👈 Back to Table of Contents


✍️ Notes for List Comprehension in Python

# The Syntax
newlist = [expression for item in iterable if condition == True]
For example :

lst  =  [x ** 2  for x in range (1, 11)   if  x % 2 == 1] 

here, x ** 2 is output expression, 
      range (1, 11)  is input sequence, 
      x is variable and   
      if x % 2 == 1 is predicate part.

📚 Resources Used in Researching List Comprehension