How to use if/else statement in value that is attribute in dictionary of python?? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

How to use if/else statement in value that is attribute in dictionary of python??

Let, dict={"xyz" :"black", "yxz" :"white", "zxy" :"white"} Now how to print name(key) only white using if/else??

20th May 2018, 3:09 AM
Mahesh Ghorsaine
Mahesh Ghorsaine - avatar
1 Resposta
+ 2
is this your doubt? for k,v in dict.items(): if k[0] == "z": print(v) o/p : white
20th May 2018, 3:36 AM
Bharath_Teki šŸ‡®šŸ‡³
Bharath_Teki šŸ‡®šŸ‡³ - avatar