mardi 21 septembre 2021

How to add spaces to a randomly generated list in Python

I want to generate random numbers, right now it only gives out the numbers. But I want to add spaces between the numbers. so its not only numbers but also randomly placed spaces between the numbers. How to I do that?

import random

def randPic():
    a = ([random.randint(1, 1000) for j in range(10)])
    return a

for i in range(10):
    a = randPic()
    print(*a, sep = ".jpg, ", end = ".jpg, \n")



Aucun commentaire:

Enregistrer un commentaire