Steps in python dictionary generator with pre-known value

Question:

Here is how the process of generating a dictionary with a known value takes place:

{K:0 for K in 'словарь'}

How is a словарь string split into keys?

Answer:

In the loop, you iterate over the string 'словарь' , at each iteration you get a character into the value K and it specifies the key of the dictionary

Scroll to Top