List Comprehension Date: 01/09/2026
# def deco(func):
# def wrapper():
# print("Before function...")
# func()
# print("After printing")
# return wrapper
# def hello():
# print("Hello World!!")
# hello=deco(hello)
# hello()
# @deco
# def hello():
# print("Hello world")
# hello()
# print(hello.__name__)
print("LIST COMPREHENSION")
a=[x for x in range(2,22,2)]
b=[x for x in range(1,11) if x%2==0]
c=["Even" if x%2==0 else "Odd" for x in range(1,11)]
print(a)
print(b)
print(c)
Comments
Post a Comment