This is the code to print 100 random numbers in a 2-d grid.
[[random.randint(1,25) for i in range(10)] for j in range(10)]
How do I print the random numbers such that out of 100 randomly printed numbers, only 25 will be of value greater than 0 ? Remaining all 75 numbers should be 0, in random positions of the grid.
Aucun commentaire:
Enregistrer un commentaire