En exécutant le code suivant, je me retrouve avec 50 fois la même ligne.
Pourquoi ?
Code : Tout sélectionner
import matplotlib.pyplot as plt
import random
image = [[0]*50]*50
# print(image)
for ligne in range(50):
for pixel in range(50):
image[ligne][pixel] = random.randint(0, 10)
# print(image)
plt.imshow(image,cmap='gray')
plt.show()
Fabrice.