I'm quite new with python and I've question to ask about lambda. I had dictionary which was needed to print sorted as by it's values.
def print_in_accordance_of_values(english_spanish):
for value, key in sorted(english_spanish.items(), key = lambda value: value[1]):
print(key, value)
def main():
english_spanish = {"hi": "hola", "thanks": "gracias", "yes": "si", "no": "no"}
print_in_accordance_of_values(english_spanish)
main()
What actually happens in this part of the code:
for value, key in sorted(english_spanish.items(), key = lambda value: value[1]):
Thank you for your answers!