d = {a:“1”, b: ‘2’, c: ‘3’}
for x in d.values():
print(x)
When I run this program it says
NameError: name ‘b’ is not defined
d = {a:“1”, b: ‘2’, c: ‘3’}
for x in d.values():
print(x)
When I run this program it says
NameError: name ‘b’ is not defined
Hello @sriman, yes along with b it a and c are also not defined.
As we cannot use the variables like this in the code. First of all, we need to declare those variables or if you need to use a,b,c then you need to use them as a character. Like, ‘a’,‘b’,‘c’
now we can use them, but simply using a b c gives the error as they are not declared.
I hope this is clear to you and in case if there is any doubt pls let me know.
In case it is clear to you pls mark it as resolve and feel free to provide the feedback and the rating.
Thanks 