0
Can anybody solve it pls?!
What I want is to print hi if hi is present in the list. And the list is present in a dict name greeting. But it's giving error! https://code.sololearn.com/cO2O3z3ZJYaO/?ref=app
2 Respostas
+ 6
greetings['user_question']
Dictionary values are accessed using [] brackets around the keys, not (). Also there is a spelling error in your key
+ 2
Kaushik ,
we can access dictionaries values also by using .get(...) method like:
if a in greetings.get('user_question'):