I have a dictionary as follows:
details={'fname':'ankur',
'lname':'sharma',
'age':29,
'skills':['HTML','CSS','Javascript','C','C++','Java'],
'language':['Hindi','English','French'],
'salary':50000
}
Now, if the user enters a value, and the value is in the dictionary, then I want to find key of that value. The following code doesn't work:
n=input('Enter value: ')
for i in details:
if n in details[i]:
print(details[i])
Suppose the user enters CSS
, then the I want print the key of that value, i.e., skills
. However, my code gives the following error:
Traceback (most recent call last):
File "main.py", line 11, in <module>
if n in details[i]:
TypeError: argument of type 'int' is not iterable