COMPREHENSION EXERCISE --IN PYTHON --DAY 5
a = int(input("enter number of items"))
d = input ("enter type of comprehension")
if d == "list ":
t = [i for i in range(a)]
elif d=="set":
t = {i for i in range(a)}
elif d =="dictionary":
t ={i:f"item{i}"for i in range(a)}
else:
print("here's nothing like that")
Comments
Post a Comment