def greet(language):
database = {'english': 'Welcome',
'czech': 'Vitejte',
'danish': 'Velkomst',
'welsh': 'Croeso'}
for k, v in database.items():
if language == k:
return v
# else: return('Welcome')
print(greet('czech'))
> Vitejte
If I uncomment else: return('Welcome') (so if the greeting language is not in the list) I expect to receive 'Welcome' but it returns 'Welcome' no matter if I enter the existing or non-existing language.
I had also tried elif language =!= k but it appeared to work in the same unwanted fashion