Skip to content

Python project #6222

@AyushSinghWhiteHat

Description

@AyushSinghWhiteHat

l = []
d = {}
s = set({})
a = int(input("ENTER HOW MANY ITEMS YOU WANT:\n:"))
b = input("WHICH COMPREHENSION YOU WANT TO PRINT 'L' FOR LIST 'D' FOR DICTIONARY 'S' FOR SET:\n:")
if b=="L" or b=="l":
for i in range(a):
i = input("ENTER YOUR ITEM:\n:")
l.append(i)
m = [item for item in l]
print(f"YOUR ITEMS IS:\n:{m}")

elif b=="D" or b=="d":
for i in range(a):
i = input("ENTER YOUR ITEM KEY:\n: ")
i1 =input("ENTER YOUR ITEM VALUE:\n: ")
d.update({i:i1})
m1 = {key:value for key,value in d.items()}
print(d)

elif b=="S" or b=="s":
for i in range(a):
i = input("ENTER YOUR ITEM:\n:")
s.add(i)
m2 = {cheez for cheez in s}
print(m2)

else:
print("INVALID INPUT TRY AGAIN")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions