How I can make a list or some type of this from 1 to 50 to don't write all 1,2,3,4... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How I can make a list or some type of this from 1 to 50 to don't write all 1,2,3,4...

To use this list in future with Random function

28th Jun 2016, 5:08 PM
Xenonium Oxygen
Xenonium Oxygen - avatar
2 Answers
+ 3
var=list(range(1,51))
28th Jun 2016, 5:52 PM
pratim
pratim - avatar
0
If you plan on using the list for random selection, randint (1,51) is a much better way to achieve. Just import it from random module using from random import randint
2nd Jul 2016, 11:31 PM
Gershon Fosu
Gershon Fosu - avatar