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.
+						
+
+