List Comprehension

 List Comprehension 

1 Normal writing Code 

lst=[1,2,4,5,7,9]
for i in range(lst[0],lst[-1]+1): #ye sab apn list comprehension se kr skte hai
if i not in lst:
print(i)

2 YE list comprehension ke saath

def FindMissing(lst):
return[i for i in range(lst[0],lst[-1]+1)
if i not in lst ]



lst=[1,2,4,5,6,8,9,11,14,16]
print(f"These are Missing Numbers = {FindMissing(lst)}")        

Source---------    https://youtu.be/m3yd3N57nVY

Comments

Popular posts from this blog

React Installation with Vite and Tailwind css (Steps to Installation)

Insert Data In mongoDb

Class methods as an alternative Constructor