List Comprehension

 # f=open("filo.txt","a+")

# # f.write("Hello, this is a test file.\n")
# a=f.read()
# print(a)

# f.close()

# with open("filo.txt", "r") as f:
#     a=f.read()
#     print(a)

# li=[x*x for x in range(1,11)]
li=[x for x in range(11) if x%2==0]
print(li)

Comments

Popular posts from this blog

Requests and Urllib

Python Time Zones