vendredi 7 septembre 2018

How to generate random values from a string in python?

I have a string 'ABCDEF', I would 4 unique characters to be generated randomly every time I run the program.

The result should give something like:

BDAF

EDCB

CAFE

...

I could use random.sample but it would require a list to be used instead, are there ways of achieving the same result using a string?




Aucun commentaire:

Enregistrer un commentaire