This is a text field

Python Dictionary

Suppose you have to store many information related to user in website .

How will you do it ?

create dictionary related to every user .then store in list . then use for loop to print all information related to users.

eg . user_0 = {“name”: “vipul” ,”age”:19}

user_1 = {“name”:”aman”,”age”:20}

users = [user_0,user_1]

for user in users:

print (user)

Output:

{“name”:”vipul”,”age”:19}

{“name” : “aman”,”age”:20}

Avatar for Vipul kunwar
Follow me

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Back to top