Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

generate a list with random length and with random numbers python

import random

def main():
    random_int = random.randint(6, 13)
    print(random_int)
    rand_list = make_list(random_int)
    num_string = ""
    for i in sorted(rand_list):
        num_string += str(i) + " "
    return num_string

def make_list(list_length):
    num_list = []
    for count in range(list_length):
        num_list.append(random.randint(1, 101))
    return num_list

print main()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #generate #list #random #length #random #numbers #python
ADD COMMENT
Topic
Name
5+8 =