lundi 2 novembre 2020

random alphabet chooser with no repeats (python)

import random

alphabet = ['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']

iterations = 1

running = True

def random_picker():

random_choice = random.choice(alphabet)

iterations =+ 1

print(random_choice)
while running == True:

    if iterations <=26:
        random_picker()
    else:
        running == False

''' I'm trying to get a different random letter through each iteration, through all 26. Each letter picked needs to update the random_choice variable. '''




Aucun commentaire:

Enregistrer un commentaire