Dictionary Comprehension : Python tutorial 137

preview_player
Показать описание
Guys please help this channel to reach 20,000 subscribers. I'll keep uploading quality content for you.

Python is easy programming language to learn and anyone can learn it, and these tutorials are 100% free in hindi.

You can share this playlist with your brother, sisters and friends. This will surely add some values to their life.

If you follow this complete playlist of python tutorial surely you will learn everything about python programming language.

This video is all about dictionary comprehension

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

Bro ur videos are the best of all... Every videos are clearly explained right from the beginning !

shubhamkurade
Автор

print("Dictionary Comprehension")

square={1:1, 2:4, 3:9}

square_small={num:num**2 for num in range(1, 11)}
print(square_small)

square_small={f"square of {num} is ":num**2 for num in range(1, 11)}
# print(square_small)

for k, v in square_small.items():
print(f"key : {k} and value : {v}" )

string ="bhaktinandan"
word_count= {char:string.count(char) for char in string}
print(word_count)

sagarbhagat
Автор

st="abababkihiuth"

dic={f"{n} appears ":f"{st.count(n)} times" for n in st }

for key, value in dic.items():
print(key, value)

akashpwl
Автор

Count ka answer hamesha one hi aayega because yadi 2nd hua bhi par bhi wo overwrite ho jayega.

prateikjindal
Автор

Sir Mobile app kese banaye please uske bare me full video share kijiye

pradipkachhadiya
Автор

String count wala programs list comprehension ke saath ho sakta hai kya

Yogibaba_youtubewala
Автор

Comprehension is only used to add items ??

harshitraj
Автор

please help me to understand why i am getting {none} in output when running following code.
Code:
dict_square = {f'square of {i} is': i**2 for i in range(1, 11)}
{print(f'{k}: {v}') for k, v in dict_square.items()}
Output:
square of 1 is: 1
square of 2 is: 4
square of 3 is: 9
square of 4 is: 16
square of 5 is: 25
square of 6 is: 36
square of 7 is: 49
square of 8 is: 64
square of 9 is: 81
square of 10 is: 100
{None}

shahidulalam
Автор

bhai mere ek question hai kiya hum dictinory ko bhai element bhi count kar sakti hai

Sumit-jzvk
Автор

plz make a reporgetery on gitthub and share your code because dropbox does not allow to use more then 50 times a link for public domain

smartchandan
Автор

Can we print the count of char in string by using f "

swetasingh
Автор

sir.
mai aapki vedio 1 month se fallow kar rha hoon function clear nhi ho rhe hain plz help.

rameshvishwakarma
Автор

Dictionary Comprehension square
How can i write this with For?

ndatta
Автор

ame="Arunava"
newdict={}
for i in name:
newdict[i]=name.count(i)
print(newdict)

#DIC COMPREHENSION
name="Arunava"
new={i:name.count(i) for i in name}
print(new)

arunavasamanta
Автор

can we do comprehension with tuple also?

deveshkumar
Автор

Don't we have to take num as a int ?

rohanrakshit
Автор

print(*sorted(list({f"Square of {i}: {i**2}" for i in range(1, 5)})), sep='\n')

pratham
Автор

square = dict(i = i**2 for i in range(1, 11))

print(square)
is this correct but i m getting error pls check

ravjotsingh
Автор

4 :10 par for k, v wala loop samjha do kese work kr rha hai ye

amantyagi
Автор

Can anyone tell me how to write below program simple way i mean without comprehension method



string = "vishal"
word_count = {char:string.count(char)for char in string}

print(word_count)

reputationsolution