It's convenient, but I think it's a kind of code that surprises me when I see it for the first time.
result = value or 1
This code is the same as the code below
if value
result = value
else:
result = 1
Recommended Posts