Ministério da Educação
Brasil um país de todos
Personal tools
You are here: Home Members Cicero Garrozi Disciplinas 2014 em diante Introdução à Programação Arquivos 2014-2 Algoritmos exercicios-funcoes.py
Navigation
Log in


Forgot your password?
 
Document Actions

exercicios-funcoes.py

by Cicero Garrozi last modified 2014-12-05 05:25

Click here to get the file

Size 1 kB - File type text/python-source

File contents

l=['fita', 'Adenilton', 'armario', 'gaveta', 'Bruna', 'adentro', 'folga', 'impressora']
Z = filter(lambda x: x[0] != 'a' and x[0] != 'A', l)
#['fita', 'gaveta', 'Bruna', 'folga', 'impressora']


>>> range(0, 11)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> map(lambda x: x*x, range(0, 11))
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
>>> map(lambda x: x*x, range(0, 11, 2))
[0, 4, 16, 36, 64, 100]
>>> map(lambda x: x*x, filter(lambda a: a%2==0, range(0, 11)))
[0, 4, 16, 36, 64, 100]
#equivalente a:
>>> K = filter(lambda a: a%2==0, range(0, 11))
>>> map(lambda x: x*x, K)
[0, 4, 16, 36, 64, 100]

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: