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

Popular posts from this blog

java chapter11 practice question on abstruct class and interfaces

DAY 12 -AZURE DP900(Microsoft Azure Data Fundamentals: Explore non-relational data in Azure)

java exercise4