2
How to add user-provided entries to a dictionary? For example:
Entree:
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 any function similar to append()
to use in dicinaries as in list? I say this because as entries will be provided by the user, you can’t keep adding input per input (dicionario['abcde'] = 1
).
As there will be several entries, I do not know how many will be exactly (since who will do it is the user) I can use a loop to go accepting the entries and creating the dictionary, correct?
– Guilherme Santana De Souza
Yes an input control mechanism works well.
– Jackowski
I’ll try. Thank you.
– Guilherme Santana De Souza