Advertisement
Guest User

Random.shuffle na matriz

a guest
Dec 30th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import random # Importa a biblioteca Random para a utilização das funções shuffle e choice
  5.  
  6. matriz = [[1,2,3],[1,4,5],[2,5,6],[5,6,7],[6,8,9],[9,10,11]]
  7. sorteados = "Dezenas sorteadas: "
  8. i = 0
  9. while i < 6:
  10.     dezena = "00"
  11.     while dezena == "00":
  12.         random.shuffle(matriz[i])
  13.  
  14.     dezena = matriz[i]
  15.     sorteados += dezena + " "
  16.     i += 1
  17. print(sorteados)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement