samedi 4 mai 2019

Is there a way to shuffle a list in python?

I'm trying to make a simple encryptions using a random abc to convert it But i'm having a problem with the Random library.

  1. Tried using some other answers that people asked on this issue on StackOverflow and none worked...
  2. Tried updating pip and tried updating random (which you cannot apparently use pip because the Random library pre-downloaded with python) tried the problematic code in python Shell and still the same problem...
import random
def random(st = 'i love cats')
    abc = 'abcdefghijklmnopqrstuvwxyz'
    randomabc = abc
    random.shuffle(randomabc)
    print(randomabc)

the expected output is a random order of the ABC the actual output is an error (the code stops before the print because of the error)




Aucun commentaire:

Enregistrer un commentaire