mercredi 27 mai 2020

How to generate random number in a list of list

I'm not good at programming so i'm here to ask help for a program that I don't know how to resolve

  1. from random import randint
  2. rain=[]
  3. x=randint(0,500)
  4. y=randint(0,500)
  5. r=2
  6. l=[x,y,r]
  7. for k in range(7):
  8. rain.append(l)
  9. print(rain)

I just want that all of the number in this list is not the same exept for r exemple:[[46, 117, 2], [46, 117, 2], [46, 117, 2], [46, 117, 2], [46, 117, 2], [46, 117, 2], [46, 117, 2]]




Aucun commentaire:

Enregistrer un commentaire