print map(metade, [k*2 for k in [66,77,88,99]])

print [metade(k*2) for k in [66,77,88,99]]

# side effect:efeito colateral (print, concatenacao) != valor de retorno

# Modulos

import sys
for i in sys.path:
    print i

import circulos

print circulos.perimetro(2)
print circulos.area(2)
print circulos.potencia(2,5)
print circulos.nada()
print circulos.potencia.__doc__ # doc definido na propria funcao

# importa funcoes:
from circulos import perimetro,area # ou import *
print perimetro(2)
print area(2)

# modulos prontos python (googlar, p/ nao reinventar a roda):

from math import pi, sin, cos, log, log10, pow

print pi
print sin(pi)
Esempio n. 2
0
from circulos import area, perimetro

radio = float(raw_input('Radio:'))
print 'El area es', area(radio)
print 'El perimetro es', perimetro(radio)