Computer Science, asked by pandeysrinath2064, 8 months ago

What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for i in d: print(i)

Answers

Answered by 8285824551
10

Answer:

0

1

2

Explanation:

It will not print the values of the keys your formed instead it will print keys in your dictionary.

Hope, it'll help you.

If it helped you then please mark as BRAINLIEST.

Answered by surajnegi0600
0

Answer:

The output of the code is:

0

1

2

Explanation:

The code creates a dictionary "d" containing keys 0, 1, and 2 and corresponding values 'a', 'b', and 'c' respectively.

The for loop iterates over the keys of the dictionary, so it will output the keys(0,1,2) one by one.

It's important to note that when iterating over a dictionary, the loop variable is assigned the key, not the value. If you want to print the values, you can use the key to access the value in the dictionary:

for i in d:

   print(d[i])

Which will produce the output:

a

b

c

More questions and answers

https://brainly.in/question/54795544

https://brainly.in/question/54795544

#SPJ3

Similar questions