How should I write a code that outputs a key containing a specific character out of all keys in the dictionary and outputs all data types included in the value?
dictionary python
If you output a specific key in a dictionary and a data type of its value,
dics = [..... ]
for i in dics:
ifi == specific key:
print(i, type(dics[i]))
dics = {"1":"people"",2":"not people"",3":"people"}
for i in dics.keys:
ifi == specific string or numeric string:
print(i,dics.get(i))
That's how it'll work.
It's a dictionary, so I made it a dictionary.
But they didn't tell me the conditions, so I just did it as I intended.
© 2024 OneMinuteCode. All rights reserved.