Python Forum
Make an array of string number in a List
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make an array of string number in a List
#6
@DOS - 5 lines vs one-liner list comprehension.... Also, no need to use if block, nor have brackets around i, no need to convert x to str for printing, finally single char names are considered bad practice
So 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

Reply


Messages In This Thread
RE: Make an array of string number in a List - by buran - May-27-2020, 07:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Extracting Version Number from a String britesc 2 1,101 May-31-2023, 10:20 AM
Last Post: britesc
  Why do I have to repeat items in list slices in order to make this work? Pythonica 7 1,354 May-22-2023, 10:39 PM
Last Post: ICanIBB
  Delete strings from a list to create a new only number list Dvdscot 8 1,549 May-01-2023, 09:06 PM
Last Post: deanhystad
  find random numbers that are = to the first 2 number of a list. Frankduc 23 3,252 Apr-05-2023, 07:36 PM
Last Post: Frankduc
  help me to make my password list in python >>> Oktay34riza 0 586 Dec-23-2022, 12:38 PM
Last Post: Oktay34riza
  prefix ID Number with 0,00 make 3 digit. mg24 1 763 Oct-06-2022, 07:20 AM
Last Post: ibreeden
  functional LEDs in an array or list? // RPi user Doczu 5 1,614 Aug-23-2022, 05:37 PM
Last Post: Yoriz
  TypeError: float() argument must be a string or a number, not 'list' Anldra12 2 4,887 Jul-01-2022, 01:23 PM
Last Post: deanhystad
  Split a number to list and list sum must be number sunny9495 5 2,306 Apr-28-2022, 09:32 AM
Last Post: Dexty
  Divide a number by numbers in a list. Wallen 7 8,057 Feb-12-2022, 01:51 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020