mercredi 18 octobre 2017

Random sample within a certain range in a list (array) | Python 3.x

I have a list with many characters in it like such:

list = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
        'r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9',
        '0'," ",'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
        'Q','R','S','T','U','V','W','X','Y','Z']

I want the program to randomly pick 8 characters within the first 26 (lowercase letters) items in my list. I will not delete or separate the other items in this array as I need them later for a similar thing.

I am somewhat new to programming and cannot understand complex solutions, although I am not stopping you from putting them out there for others to see. Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire