mardi 21 janvier 2020

Creating Unsorted List in range 100,000 to 1000,000

"I am looking to create a function that would return unsorted list of 20 numbers in range 100 to 1000 (in thousands) and need not be unique. Further, I am looking for them to be multiples of 25. In the next step, I am looking to sort them from smallest to largest. I am looking for help on how to insert the restrictions of max 20 random UNSORTED numbers divisible by 25"

def bookinventory(i,j):
    import random
    booknumber = [x for x in range(i,j)]
    random.shuffle(booknumber)
    print(booknumber)

def main():
    books = bookinventory(100000,1000000)
    print(books)


if __name__ == '__main__':
    main()



Aucun commentaire:

Enregistrer un commentaire