Objective
Create a Python program that builds a dictionary with a dictionary comprehension.
Instructions
- Read a line with words separated by spaces.
- With a dictionary comprehension, create a dictionary that associates each word with its length. If a word is repeated, it appears only once.
- Show one line per word, sorted alphabetically, with the format
word: length.
sol mar sol cielo
cielo: 5
mar: 3
sol: 3
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise