I am looking to generate a list of enumerated strings using list comprehension in IPython Notebook. It works, but gives me a strange result that I donβt understand.
cols = []
[cols.append('Value'+str(hour)) for hour in xrange(1,25)]
After starting the cell, it colsreturns the correct list [Value1,Value2...Value24], but in my laptop I get a list of 24 results None. Sample photo
The code works, but the weird conclusion makes me feel like I did something wrong and it looks messy. Why am I getting this conclusion, and is there a way to get rid of it?
source
share