Computação I - Python Aula 6 - Teórica: ListasComputac˜ao I - Python Aula 6 - Teo´rica: Listas...
Transcript of Computação I - Python Aula 6 - Teórica: ListasComputac˜ao I - Python Aula 6 - Teo´rica: Listas...
Computacao I - Python
Aula 6 - Teorica: Listas
Joao C. P. da Silva
Carla A. D. M. Delgado
Ana Luisa Duboc
Dept. Ciencia da Computacao - UFRJ
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 1 / 31
Listas - Fatias
Podemos usar a notacao de fatias (slices) em listas:
[start : end] : vai do ındice start ate o ındice end
[start : ] : vai de start ate o final da lista
[ : end] : vai do inıcio da lista ate end
[ : ] : copia a lista toda
1 >>> c = [−45 ,6 ,3 ,0 ,1 ,19 ,32 ,−23 ,12 ,5 ,−3 ,8 ,2]23 >>> c [−1:−5:1]456 >>> c [−5:−1:1]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 2 / 31
Listas - Fatias
Podemos usar a notacao de fatias (slices) em listas:
[start : end] : vai do ındice start ate o ındice end
[start : ] : vai de start ate o final da lista
[ : end] : vai do inıcio da lista ate end
[ : ] : copia a lista toda
1 >>> c = [−45 ,6 ,3 ,0 ,1 ,19 ,32 ,−23 ,12 ,5 ,−3 ,8 ,2]23 >>> c [−1:−5:1]4 [ ]56 >>> c [−5:−1:1]7 [12 , 5 , −3, 8 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 3 / 31
Listas - Fatias
Podemos usar a notacao de fatias (slices) em listas:
[start : end] : vai do ındice start ate o ındice end
[start : ] : vai de start ate o final da lista
[ : end] : vai do inıcio da lista ate end
[ : ] : copia a lista toda
Exemplo
1 >>> l i s t a = [ ’ a ’ , 2 , [ 3 , ’ f ’ ] , ’ q ’ ]23 >>> l i s t a [ 1 : ]456 >>> l i s t a [ : 1 ]789 >>> l i s t a [ 1 : 2 ]
101112 >>> l i s t a [0:−1]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 4 / 31
Listas - Fatias
Podemos usar a notacao de fatias (slices) em listas:
[start : end] : vai do ındice start ate o ındice end
[start : ] : vai de start ate o final da lista
[ : end] : vai do inıcio da lista ate end
[ : ] : copia a lista toda
Exemplo
1 >>> l i s t a = [ ’ a ’ , 2 , [ 3 , ’ f ’ ] , ’ q ’ ]23 >>> l i s t a [ 1 : ]4 [ 2 , [ 3 , ’ f ’ ] , ’ q ’ ]56 >>> l i s t a [ : 1 ]7 [ ’ a ’ ]89 >>> l i s t a [ 1 : 2 ]
10 [ 2 ]1112 >>> l i s t a [0:−1]13 [ ’ a ’ , 2 , [ 3 , ’ f ’ ] ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 5 / 31
Listas - Fatias
Incremento: podemos usar incremento / decremento para selecionar oselementos de uma fatia:
[start : end : step] : vai do ındice start ate end (sem ultrapassa-lo), com passostep.
Exemplo
1 >>> l i s t a = [ 1 , 2 , 3 , 4 , 5 , 6 ]23 >>> l i s t a [0 : −1 : 2 ]456 >>> l i s t a [5 : 0 : −1 ]789 >>> l i s t a [0 : −1 : 3 ]
101112 >>> l i s t a [ : : −1 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 6 / 31
Listas - Fatias
Incremento: podemos usar incremento / decremento para selecionar oselementos de uma fatia:
[start : end : step] : vai do ındice start ate end (sem ultrapassa-lo), com passostep.
Exemplo
1 >>> l i s t a = [ 1 , 2 , 3 , 4 , 5 , 6 ]23 >>> l i s t a [0 : −1 : 2 ] # I n d i c e 0 at e o i n d i c e −2 de 2 em 24 [ 1 , 3 , 5 ]56 >>> l i s t a [5 : 0 : −1 ] # I n d i c e 5 at e o i n d i c e 1 de 1 em 17 [ 6 , 5 , 4 , 3 , 2 ]89 >>> l i s t a [0 : −1 : 3 ] # I n d i c e 0 at e o i n d i c e −2 de 3 em 3
10 [ 1 , 4 ]1112 >>> l i s t a [ : : −1 ] # I n v e r t e a l i s t a13 [ 6 , 5 , 4 , 3 , 2 , 1 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 7 / 31
Listas - Fatias
Atribuicao: ao atribuir uma sequencia a uma fatia, os elementos destadevem ser substituıdos pelos elementos daquela.
1 >>> l i s t a = [ 1 , 2 , 3 , 4 , 5 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 8 / 31
Listas - Fatias
Atribuicao: ao atribuir uma sequencia a uma fatia, os elementos destadevem ser substituıdos pelos elementos daquela.
1 >>> l i s t a = [ 1 , 2 , 3 , 4 , 5 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 9 / 31
Listas - Fatias
Atribuicao: ao atribuir uma sequencia a uma fatia, os elementos destadevem ser substituıdos pelos elementos daquela.
1 >>> l i s t a = [ 1 , 2 , 3 , 4 , 5 ]2
3 >>> n o v a l i s t a = [ 8 , 1 0 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 10 / 31
Listas - Fatias
1 >>> l i s t a = [ 1 , 2 , 3 , 4 , 5 ]2 >>> l i s t a [ 1 : 1 ] = [ ’ z ’ ]3
4
5 >>> l i s t a [ 1 : 3 ] = [ [ 7 ] ]6
7
8 >>> l i s t a [1 : −1] = [ 8 , 9 , 1 0 ]9
10
11 >>> l i s t a [ : 3 ] = ” xyz ”12
13
14 >>> l i s t a [ : 3 ] = ”a , b , c ”15
16
17 >>> l i s t a [ : 2 ] = 1 ,2 ,3
Observe que a lista vai sendo alterada
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 11 / 31
Listas - Fatias
1 >>> l i s t a = [ 1 , 2 , 3 , 4 , 5 ]2 >>> l i s t a [ 1 : 1 ] = [ ’ z ’ ]3 [ 1 , ’ z ’ , 2 , 3 , 4 , 5 ]4
5 >>> l i s t a [ 1 : 3 ] = [ [ 7 ] ]6 [ 1 , [ 7 ] , 3 , 4 , 5 ]7
8 >>> l i s t a [1 : −1] = [ 8 , 9 , 1 0 ]9 [ 1 , 8 , 9 , 10 , 5 ]
10
11 >>> l i s t a [ : 3 ] = ” xyz ”12 [ ’ x ’ , ’ y ’ , ’ z ’ , 10 , 5 ]13
14 >>> l i s t a [ : 3 ] = ”a , b , c ”15 [ ’ a ’ , ’ , ’ , ’ b ’ , ’ , ’ , ’ c ’ , 10 , 5 ]16
17 >>> l i s t a [ : 2 ] = 1 ,2 ,318 [ 1 , 2 , 3 , ’ b ’ , ’ , ’ , ’ c ’ , 10 , 5 ]
Observe que a lista vai sendo alterada
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 12 / 31
Alias e Tipos Mutaveis
Relembrando - um alias acontece quando duas variaves se referem ao mesmo dado:
1 >>> y = [ 1 , 2 , 3 ]2 >>> x = y3 >>> x4 [ 1 , 2 , 3 ]5 >>> y6 [ 1 , 2 , 3 ]
Qualquer nova atribuicao feita a uma das variaveis quebrara o alias entre elas.
1 >>> x = [ 4 , 5 , 6 ]2 >>> x3 [ 4 , 5 , 6 ]4 >>> y5 [ 1 , 2 , 3 ]
Porem quando o dado e mutavel (lista!!), o alias nao e quebrado caso uma atribuicao modifique uma parte do dado:
1 >>> y = [ 1 , 2 , 3 ]2 >>> x = y3 >>> x [1 ]=1 . 54 >>> x5 [ 1 , 1 . 5 , 3 ]6 >>> y7 [ 1 , 1 . 5 , 3 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 13 / 31
Listas - Copias
Cuidado quando fizer copia de listas!
1 >>> l 1 = [ 1 , 2 , 3 , 4 , 5 ]2 >>> l 2 = l 13 >>> l 14 [ 1 , 2 , 3 , 4 , 5 ]5
6 >>> l 27 [ 1 , 2 , 3 , 4 , 5 ]8
9 >>> l 2 [0]=910 >>> l 211 [ 9 , 2 , 3 , 4 , 5 ]12
13 >>> l 114 [ 9 , 2 , 3 , 4 , 5 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 14 / 31
Listas - Copias
Cuidado quando fizer copia de listas!
1 >>> l 1 = [ 1 , 2 , 3 , 4 , 5 ]2 >>> l 2 = l 1 [ : ]3 >>> l 14 [ 1 , 2 , 3 , 4 , 5 ]5
6 >>> l 27 [ 1 , 2 , 3 , 4 , 5 ]8
9 >>> l 2 [0]=910 >>> l 211 [ 9 , 2 , 3 , 4 , 5 ]12
13 >>> l 114 [ 1 , 2 , 3 , 4 , 5 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 15 / 31
Manipulacao de Listas
Alem dos operadores + (concatenacao) e * (usado para multiplasconcatenacoes) podemos manipular listas usando:
append : outra forma de concatenacao. Neste caso, a lista e tratadacomo uma fila.
extend : permite adicionar os elementos de uma lista a outra.
del : remover elemento de uma lista.
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 16 / 31
Manipulacao de Listas
1 >>> l i s t a =[]2 >>> l i s t . append ( l i s t a , ’ a ’ )3 >>> l i s t a4 [ ’ a ’ ]5
6 >>> l i s t . append ( l i s t a , 2 )7 >>> l i s t a8 [ ’ a ’ , 2 ]9
10 >>> l i s t . append ( l i s t a , [ 3 , ’ f ’ ] )11 >>> l i s t a12 [ ’ a ’ , 2 , [ 3 , ’ f ’ ] ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 17 / 31
Manipulacao de Listas
1 >>> l i s t a2 [ ’ a ’ , 2 , [ 3 , ’ f ’ ] ]34 >>> l i s t . extend ( l i s t a , [ ’ q ’ ] )5 >>> l i s t a6 [ ’ a ’ , 2 , [ 3 , ’ f ’ ] , ’ q ’ ]78 >>> l i s t . extend ( l i s t a , [ 3 , 7 ] )9 >>> l i s t a
10 [ ’ a ’ , 2 , [ 3 , ’ f ’ ] , ’ q ’ , 3 , 7 ]1112 >>> l i s t . extend ( l i s t a , 1 0 )13 Traceback (most r e c e n t c a l l l a s t ) :14 F i l e ”<p y s h e l l#11>” , l i n e 1 , i n <module>15 l i s t . extend ( l i s t a , 1 0 )16 TypeError : ’ i n t ’ o b j e c t i s not i t e r a b l e1718 >>> l i s t . extend ( l i s t a , ” bo l a ” )19 >>> l i s t a20 [ ’ a ’ , 2 , [ 3 , ’ f ’ ] , ’ q ’ , 3 , 7 , ’ b ’ , ’ o ’ , ’ l ’ , ’ a ’ ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 18 / 31
Manipulacao de Listas
1 >>> l i s t a2 [ ’ a ’ , 2 , [ 3 , ’ f ’ ] , ’ q ’ , 3 , 7 , ’ b ’ , ’ o ’ , ’ l ’ , ’ a ’ ]34 >>> d e l l i s t a [ 1 ]5 >>> l i s t a6 [ ’ a ’ , [ 3 , ’ f ’ ] , ’ q ’ , 3 , 7 , ’ b ’ , ’ o ’ , ’ l ’ , ’ a ’ ]78 >>> d e l l i s t a [ 7 ]9 >>> l i s t a
10 [ ’ a ’ , [ 3 , ’ f ’ ] , ’ q ’ , 3 , 7 , ’ b ’ , ’ o ’ , ’ a ’ ]11 # Como o segundo e l emento de l i s t a e uma l i s t a ,12 # posso r e t i r a r de s t a seu segundo e l emento1314 >>> d e l l i s t a [ 1 ] [ 1 ]15 >>> l i s t a16 [ ’ a ’ , [ 3 ] , ’ q ’ , 3 , 7 , ’ b ’ , ’ o ’ , ’ a ’ ]1718 >>> d e l l i s t a [ 2 ] [ 1 ]19 Traceback (most r e c e n t c a l l l a s t ) :20 F i l e ”<p y s h e l l#20>” , l i n e 1 , i n <module>21 d e l l i s t a [ 2 ] [ 1 ]22 TypeError : ’ s t r ’ o b j e c t doesn ’ t suppor t i tem d e l e t i o n
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 19 / 31
Manipulacao de Listas
list.insert(lista,ındice, elemento): insere elemento na lista na posicao indicada por ındice.
1 >>> l i s t a = [ 0 , 1 , 2 , 3 ]23 >>> l i s t . i n s e r t ( l i s t a , 1 , ’ d o i s ’ )45 >>> l i s t a6 [ 0 , ’ d o i s ’ , 1 , 2 , 3 ]
Como o extend, altera a lista ao inves de retornar a lista. O valor retornado e None!
Atribuicoes a fatias servem para a mesma finalidade mas sao menos legıveis.
1 >>> l i s t a = [ 0 , 1 , 2 , 3 ]23 >>> l i s t a [ 1 : 1 ] = [ ’ d o i s ’ ]45 >>> l i s t a6 [ 0 , ’ d o i s ’ , 1 , 2 , 3 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 20 / 31
Manipulacao de Listas
list.remove(lista, elemento): Remove da lista o primeiro elemento igual aelemento. Se nao existe tal elemento, um erro e gerado.
1 >>> l i s t a = [ ’ o i ’ , ’ a l o ’ , ’ o l a ’ ]2
3 >>> l i s t . remove ( l i s t a , ’ a l o ’ )4
5 >>> l i s t a6 [ ’ o i ’ , ’ o l a ’ ]7
8 >>> l i s t . remove ( l i s t a , ’ oba ’ )9
10 Traceback (most r e c en t c a l l l a s t ) :11 F i l e ”<p y s h e l l#116>” , l i n e 1 , i n <module>12 l i s t . remove ( l i s t a , ”oba” )13 Va l u eE r r o r : l i s t . remove ( x ) : x not i n l i s t
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 21 / 31
Manipulacao de Listas
list.remove(lista, elemento): Remove da lista o primeiro elemento igual aelemento. Se nao existe tal elemento, um erro e gerado.
1 >>> l i s t a = [1 , 3 , 6 , 7 , 1 , 5 , 1 ]2 >>> l i s t . remove ( l i s t a , 1 ) # Remove apenas a p r im e i r a3 # oco r r e n c i a do e lemento !4 >>> l i s t a5 [ 3 , 6 , 7 , 1 , 5 , 1 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 22 / 31
Manipulacao de Listas
Observe a diferenca entre del e remove:
Suponha lista = [4,6,7,1,2], e digamos que quero deletar o elemento 1.
Para o del e preciso indicar o ındice do elemento da lista que se desejadeletar: del lista[3]
Enquanto que para o remove basta indicar o elemento a ser deletado:list.remove(lista, 1)
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 23 / 31
Manipulacao de Listas
list.pop(lista, ındice): Remove da lista o elemento na posicao ındice e o retorna.Se ındice nao for mencionado, e assumido o ultimo.
1 >>> l i s t a = [ 1 , 2 , 3 , 4 ]2 >>> l i s t . pop ( l i s t a )3 445 >>> l i s t a6 [ 1 , 2 , 3 ]78 >>> d e l e t a do = l i s t . pop ( l i s t a , 1 )9 >>> d e l e t a do
10 21112 >>> l i s t a13 [ 1 , 3 ]
A diferenca entre del e pop e que este retorna o elemento deletado,enquanto o del nao.
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 24 / 31
Manipulacao de Listas
list.count(lista, elemento): Retorna quantas vezes o elemento aparece na lista.
1 >>> l i s t a = [9 , 8 , 33 , 12 , 33 ]2 >>> l i s t . count ( l i s t a , 3 3 )3 2
list.index(elemento): Retorna o ındice da primeira ocorrencia de elemento nalista. Um erro ocorre se elemento nao consta da lista.
1 >>> l i s t . i nd e x ( l i s t a , 33)2 23 >>> l i s t . i nd e x ( l i s t a , 7 )4 Traceback (most r e c e n t c a l l l a s t ) :5 F i l e ”<p y s h e l l #110>” , l i n e 1 , i n <module>6 l i s t a . i nd ex (7)7 Va l u eE r r o r : 7 i s not i n l i s t
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 25 / 31
Manipulacao de Listas
OBSERVACAO: Usar o index para saber se o elemento esta numalista nao e uma boa ideia, porque se nao estiver, dara erro.
Uma forma de saber se um elemento esta numa lista e usar o in,conforme exemplificado abaixo:
1 >>> l i s t a = [ 1 , 4 , 8 , 3 , 2 ]2 >>> 2 i n l i s t a3 True4
5 >>> 10 i n l i s t a6 Fa l s e
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 26 / 31
Manipulacao de Listas
Faca uma funcao que dada uma lista e um elemento, retorna em que posicao da lista aqueleelemento se encontra. Se o elemento nao estiver na lista, retorne uma mensagem. Obs: Garantaque nao havera erro.
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 27 / 31
Manipulacao de Listas
Faca uma funcao que dada uma lista e um elemento, retorna em que posicao da lista aqueleelemento se encontra. Se o elemento nao estiver na lista, retorne uma mensagem. Obs: Garantaque nao havera erro.
1 de f p rocu ra ( l i s t a , e l emento ) :2 ”Funcao que p rocu ra um e lemento em uma l i s t a , e r e t o r n a3 a po s i c a o em que e l e e s t a ou uma mensagem de e r r o4 caso o e l emento nao e s t e j a na l i s t a5 Parametro de Entrada : l i s t , any t ype6 Va l o r de Retorno : i n t / s t r ”78 i f e l emento i n l i s t a :9 r e t u r n l i s t . i nde x ( l i s t a , e l emento )
10 e l s e :11 r e t u r n ’Nao e s t a na l i s t a ’
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 27 / 31
Manipulacao de Listas
Faca uma funcao que dada uma lista e um elemento, retorna em que posicao da lista aqueleelemento se encontra. Se o elemento nao estiver na lista, retorne uma mensagem. Obs: Garantaque nao havera erro.
1 de f p rocu ra ( l i s t a , e l emento ) :2 ”Funcao que p rocu ra um e lemento em uma l i s t a , e r e t o r n a3 a po s i c a o em que e l e e s t a ou uma mensagem de e r r o4 caso o e l emento nao e s t e j a na l i s t a5 Parametro de Entrada : l i s t , any t ype6 Va l o r de Retorno : i n t / s t r ”78 i f e l emento i n l i s t a :9 r e t u r n l i s t . i nde x ( l i s t a , e l emento )
10 e l s e :11 r e t u r n ’Nao e s t a na l i s t a ’
1 >>> po s i c a o = procura ( [ 1 , 4 , 8 , 3 , 2 ] , 2 )2 >>> po s i c a o3 44 >>> po s i c a o = procura ( [ 1 , 4 , 8 , 3 , 2 ] , 7 )5 >>> po s i c a o6 ’Nao e s t a na l i s t a ’
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 27 / 31
Manipulacao de Listas
list.reverse(lista): inverte a ordem dos elementos da lista.
1 >>> l i s t a =[1 , 2 , 3 ]2 >>> l i s t . r e v e r s e ( l i s t a )3 >>> l i s t a4 [ 3 , 2 , 1 ]
list.sort(lista): ordena uma lista.
1 >>> l i s t a =[2 , 1 , 3 ]2 >>> l i s t . s o r t ( l i s t a )3 >>> l i s t a4 [ 1 , 2 , 3 ]
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 28 / 31
Manipulacao de Listas
ATENCAO
Algumas funcoes que manipulam listas nao possuem valor de retorno:
list.append
list.extend
list.insert
list.remove
list.reverse
list.sort
Enquanto outras possuem:
list.pop
list.count
list.indexhttp://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 29 / 31
Manipulacao de Listas
Considere a funcao alteraLista abaixo:1 de f a l t e r a L i s t a ( l i s t a ) :2 ”Parametro de Entrada : l i s t3 Va l o r de Retorno : l i s t ”45 l i s t . append ( l i s t a , 1 0 )6 l i s t . append ( l i s t a , [ 3 , ’ bo l a ’ ] )7 l i s t . append ( l i s t a , ’ l ua ’ )8 l i s t . extend ( l i s t a , [ 1 , 2 , 3 ] )9 l i s t . extend ( l i s t a , ’ l ua ’ )
10 d e l l i s t a [ 2 ]11 l i s t . i n s e r t ( l i s t a , 2 , 1 )12 l i s t . remove ( l i s t a , 2 )13 e l emento = l i s t . pop ( l i s t a , 3 )14 l i s t . i n s e r t ( l i s t a , 1 , e l emento )15 r e t u r n l i s t a
Qual sera a saıda da funcao se a chamada for alteraLista([4,5])
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 30 / 31
Autores
Joao C. P. da Silva Lattes
Carla Delgado Lattes
Ana Luisa Duboc Lattes
Colaboradores
Anamaria Martins Moreira Lattes
Fabio Mascarenhas Lattes
Leonardo de Oliveira Carvalho Lattes
Charles Figueiredo de Barros Lattes
Fabrıcio Firmino de Faria Lattes
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 31 / 31
Computacao I - Python
Aula 6 - Teorica: Listas
Joao C. P. da Silva
Carla A. D. M. Delgado
Ana Luisa Duboc
Dept. Ciencia da Computacao - UFRJ
http://www.dcc.ufrj.br/˜pythonUFRJ/ Computacao I - Python Aula 6 32 / 31