Computer Science, asked by prachi2102, 2 months ago

39)What will be the output of the following
Python code snippet? d = {"john":40, "peter":45)
print(list(d.keys()))
1 point
["john", "peter"]
L"john":40, “peter":45]
("john", “peter")
("john":40, "peter":45)

Answers

Answered by dreamrob
2

Code :

d = {"john":40, "peter":45}

print(list(d.keys()))

Output :

['john', 'peter']

Extra information :

Code 1 :

d = {"john":40, "peter":45}

print(d)

Output :

{'john': 40, 'peter': 45}

Code 2 :

d = {"john":40, "peter":45}

print(d.keys())

Output :

dict_keys(['john', 'peter'])

Code 3 :

d = {"john":40, "peter":45}

print(d.values())

Output :

dict_values([40, 45])

Similar questions