May-27-2020, 07:18 AM
@DOS - 5 lines vs one-liner list comprehension.... Also, no need to use if block, nor have brackets around
So if you insist on expanding list comprehension
i
, no need to convert x
to str for printing, finally single char names are considered bad practiceSo if you insist on expanding list comprehension
my_list = [] for number in range(1, 101): my_list.append(str(number)) print(my_list)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs