3 ms·
> So it's hard to tell the difference between a value not being filled and a value being filled with an empty value. >>> answers = {} >>> if answers["I don
by wizzwizz4 4y ago
> So it's hard to tell the difference between a value not being filled and a value being filled with an empty value.
>>> answers = {}
>>> if answers["I don't exist"]:
... print("a")
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
if answers["I don't exist"]:
KeyError: "I don't exist"
The method you're trying to use doesn't work anyway: it doesn't matter that it's confusing. You'd have the same problem with the value False.