Created
July 13, 2019 03:44
-
-
Save dunossauro/75bf3cb742b93557e21ef82ccc3cdd76 to your computer and use it in GitHub Desktop.
Rapidinha pythonica 8 - https://youtu.be/FAoMykdLkNs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t1 = ('Eduardo', 'Mendes', 25) | |
# desempacotamos em variáveis | |
nome, sobre, idade = t1 | |
t2 = (('Eduardo', 'Mendes'), 25) | |
# desempacotamos em variáveis compostas | |
(nome, sobre), idade = t2 | |
l1 = ['Eduardo', 25, 'Martha', 'Cesar'] | |
nome, idade, mae, pai = l1 | |
nome, idade, *pais = l1 | |
*user, pai, mae = l1 | |
pai, mae = mae, pai | |
def xpto(a, b, c): | |
return a, b, c | |
xpto(1, 2, 3) | |
(1, 2, 3) | |
xpto(*l3) | |
('a', 'b', 'c') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment