If I have an object (say, nums). I am confused which one to use in interviews:
# Option 1
if nums:
print(nums)
# Option 2
if nums is not None:
print(nums)These two are completely different. Option 1 works well for empty collections, empty strings, 0 and None. While Option 2 works only for None. Which one do the interviewers prefer?