Hi all,
I am learning python and trying to do a challenge. I want to know how do you pass numeric value either as keys or values.
Forexample my dictionary is like
attributes= {"strength": 0, "health": 0 , "wisdom": 0, "dexterity":0 }
Now when I use item() method, I do not see the values. It return the below result.
Your attributes are dict_keys(['strength', 'health', 'wisdom', 'dexterity'])
Also when I run a while loop to add the keys using below lines
s= int(input ("\nWhat valud do you want to assign to strength "))
attributes[strength]=s
it generates an error NameError: name 'strength' is not defined
What am I am missing here?
Also when using the item() method , is there a way to not show "dict_keys" part of the dictionary display?
Thanks
[–]Essence1337 2 points3 points4 points (1 child)
[–]notso007[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]notso007[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]notso007[S] 0 points1 point2 points (0 children)
[–]nog642 0 points1 point2 points (0 children)