Python Tutorial 30: Dictionaries And While Loops

preview_player
Показать описание
Hey what's going on guys welcome back to the another python tutorial . Yea , so in this video we will see how to use while loops to insert new keys and values into a dictionary. It is exactly same as we did for the for loop .

Link To My Python Tutorial Playlist :

Link To My Front-End Projects Playlist :

 I upload programming videos regularly , so if you guys are interested in learning programming you can subscribe and turn the notification bell on , for more such videos.
I recently started front end development , you can check out my front end playlist for more front end tutorials in html , css and javascript.

If you are new to the channel and if you haven't subscribed yet , please go ahead and subscribe .

If you have anything to say about my codes or if you have any doubts regarding what i explain , you can always comment down below about your issue and i will make sure to answer your questions.

Thanks for watching , stay home , stay blessed.

#python #pythonprogramming
Рекомендации по теме
Комментарии
Автор

thanks for your video!, I was able to use it to understand how to make a self building dictionary, much appreciated

dictionary = {} # dictionary is a container data type for key: value
i=0
while i < 10:
p = str(i)
key = str("Item " + p) # this is the key string
value = i + 1000 # this is the value integer
dictionary[key] = value #this is the line that populates the dictionary each time thru the loop
i = i + 1 #this iterates thru the loop until 10 is reached
print(dictionary)
print(dictionary.get("Item 4"))

stephen
Автор

Thankyou for this, how do you search for an item in a dictionary using either key or value?

aroojfatima
Автор

Nice one! What if we want to store name and marks both for a particular roll number?

sanjroks