[Solved] what is the difference? Why the first one give me an error?
When you call dict() with an iterable it expects that iterable to return pairs of values, that it can use as keys and values to create the dict. So, these examples are all valid: dict([(‘key’, ‘value’), (‘other_key’, ‘other_value’)]) dict([‘ab’, ‘bc’, ‘dd’]) # ‘ab’ is pretty much equivalent to a list [‘a’, ‘b’] dict([[‘a’, 1], [‘b’, … Read more