mardi 23 juillet 2019

Random list only with -1 and 1

I need to create random list which consists only of -1 and 1 like -1,1,1,-1,-1 (without zeros). My current coding adds 0 that doesn't suite me.

import random
for x in range(10):
    print (random.randint(-1,1))




Aucun commentaire:

Enregistrer un commentaire