79564434

Date: 2025-04-09 13:19:14
Score: 0.5
Natty:
Report link

Another way:

test_list = ['one', 'two', None]    
res = [i or 'None' for i in test_list]

Even better if you're working with numbers, since int(None) gives an error:

test_list = [1, 2, None]    
res = [i or 0 for i in test_list]
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: DonLarry