dic = {'H':1, 'e':1, 'l':3, 'o':2, '':1, 'w':1, 'r':1, 'd':1}
I'm trying to make it into Hello world
. I don't know what to do because I'm trying to make it using dictionary only. Please give me some advice
Dictionary is an unordered data structure unlike list and tuple.
Therefore, there is no way to always create "Hello world" through dic
above.
It may be possible to use an ordered dictionary with the collection module , but it cannot be done with a regular dictionary.
Why are you trying to make a string into a dictionary??
© 2024 OneMinuteCode. All rights reserved.