Here is my code:
import random
def randnum():
rando = random.sample(range(1000,9999),1)
strrando = list(str(rando))
return strrando
The purpose is being fulfilled, I am generating a list of 4 randomly generated numbers which are turned to type string. The only problem it generates a list that has a set of brackets as strings in the list itself, so it generates 6 strings instead of the 4. I was wondering if anyone could explain to me why this happens?
Aucun commentaire:
Enregistrer un commentaire