samedi 26 juin 2021

random output from random variable discord.py

here's the current code:

@client.command()
async def randousername(ctx):
    Letters = ['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']
    Numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']

    randomLetter = random.choice(Letters)
    randomNumber = random.choice(Numbers)
    RandomRandom = random.choice('RandomLetter', 'RandomNumber')
    print(RandomRandom, RandomRandom)

now im gonna explain what I'm trying to do with it:

I'm trying to give a random output of numbers and letters. To make it fully random, I wanna make the randomNumber and randomLetter's positions in the output also be random.

another explanation: Let's say that I print(randomNumber,randomLetter), and this printed "2o". the code will never be able to print "o2", since the random number is placed before the random letter.

how would I be able to make that happen?




Aucun commentaire:

Enregistrer un commentaire