I saw somewhere a variable was stored with an and
between two variables. Do you know the purpose of this? It seems to only store the second value as the variable, even when the second value is None
.
y = 5 and 7
print(y)
7
h = None
y = 5 and h
None
Is there any purpose for this? I'm wondering why it doesn't just throw an error since the first value seems to always be ignored. Not a duplicate question because no question is asked about storing variables this way and my phrasing is totally different than the supposed duplicate. The founder of Stack Overflow has said even if questions are duplicate if the phrasing is different it is not a duplicate because some questions have to be phrased differently in order for more people to find the answer they are searching for. Supposed duplicate does not ask or answer my questions at all.