How do you make a list 0 to 100 in python?
Create a list of 100 integers whose value and index are the same, e.g. Show
Here is my code.
Veedrac 55.7k14 gold badges108 silver badges165 bronze badges asked Sep 26, 2013 at 3:49
2 Since nobody else
realised you're using Python 3, I'll point out that you should be doing answered Sep 26, 2013 at 4:22
VeedracVeedrac 55.7k14 gold badges108 silver badges165 bronze badges 2 Use range() for generating such a list
answered Sep 26, 2013 at 3:50
If you want to get a list of numbers
between 0-100, use
The answer to your question is pretty much
answered Sep 26, 2013 at 3:50
TerryATerryA 56.9k11 gold badges117 silver badges137 bronze badges You can use
Or you could do this recursively:
answered Sep 26, 2013 at 3:52
tom10tom10 64.7k9 gold badges122 silver badges134 bronze badges 1 Also can use List Comprehensions, like
answered Apr 30, 2018 at 12:58
If you want to import
Should work in python2.7 and python3.x answered Apr 28, 2018 at 18:07
double-beep 4,58613 gold badges30 silver badges40 bronze badges answered Apr 29, 2020 at 2:47
2 How do you make a list of numbers in Python?Python comes with a direct function range() which creates a sequence of numbers from start to stop values and print each item in the sequence. We use range() with r1 and r2 and then convert the sequence into list.
How do I make a list of numbers?To start a numbered list, type 1, a period (.), a space, and some text. Word will automatically start a numbered list for you. Type* and a space before your text, and Word will make a bulleted list. To complete your list, press Enter until the bullets or numbering switch off.
How do you create an array from 1 to 10 in Python?Using the range() function to create an array of 1 to 10 in Python.. Using list comprehension along with the range() function to create an array of 1 to 10 in Python.. Using a user-defined function to create an array of 1 to 10 in Python.. Using the NumPy. arange() function to create an array of 1 to 10 in Python.. |