From 587d3f7e6915f70b144d24d66f78b4925d71ab70 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Wed, 13 Sep 2017 20:57:57 -0300 Subject: [PATCH] a bit more python --- fujindo-com-python.html | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/fujindo-com-python.html b/fujindo-com-python.html index bf6dcfd..d2bb6dd 100644 --- a/fujindo-com-python.html +++ b/fujindo-com-python.html @@ -353,6 +353,39 @@ print(frase.format(*consoantes)) + +
+
+

Passo 2: Randomizar a lista

+ +

+import random
+
+consoantes = ['f', 'j', 'c', 'l', 'n']
+random.shuffle(consoantes)
+frase = '{}u{}am para as {}o{}i{}as'
+print(frase.format(*consoantes))
+						
+
+ +
+

Pausa: shuffle e "in place"

+ +

+>>> import random
+>>> help(random.shuffle)
+						
+
+ +
+

Pausa: shuffle e "in place"

+ +

+shuffle(self, x, random=None) method of random.Random instance
+    x, random=random.random -> shuffle list x in place; return None.
+						
+
+