Bavaria={'Number_of_solders':1500, 'Strength':5}
print ('Which country is attacking? ')
a=input()
print ('Number of attacking forces of '+a+' is '+a['Number_of_soldiers']+' men!')
Error:
Traceback (most recent call last):
line 6, in <module>
print ('Number of attacking forces of '+a+' is '+a['Number_of_soldiers']+' men!')
TypeError: string indices must be integers
How can retrieve value or key from the dictionary, name of which is given by user?