How do I add entries provided by a user in a dictionary? For example:
Entry:
1 abcde
2 adecd
3 aaabb
The created dictionary would be:
dicionario = {'abcde' : 1, 'adecd' : 2, 'aaabb' : 3}
or
dicionario = {1 : 'abcde', 2 : 'adecd', 3 : 'aaabb'}
Is there a function similar to append()
to use in dicinarios as it is used in list? I say this because as the inputs will be provided by the user, you can not be adding input per input ( dicionario['abcde'] = 1
).