associação pythonbrasil[11] django zope/plone planet Início Logado como (Entrar)

Revisão 2e 2009-06-06 21:12:57

Excluir mensagem

ExerciciosFuncoesSolucoes

Exercícios com Funções: Proposta de Soluções

Esta página contém algumas propostas de soluções para os exercícios da Lista 6: Funções.

  • Exercício 1
       1  def exercicio1(n):
       2      for i in range(1, n+1):
       3          for j in range(i):
       4              print i,         # print j times the number i in the same line 
       5          print                # print a new line
    

    Proposta por HenriqueBaggio

  • Exercício 2
       1  def exercicio2(n):
       2      for i in range(1, n+1):
       3          for j in range(i):
       4              print j,          # print a line with 0 1 ... i 
       5          print                 # print a new line
    

    Proposta por HenriqueBaggio

  • Exercício 3
       1  def exercicio3(a, b, c):
       2      return a + b + c
    

    Proposta por IuriSilvio

  • Exercício 4
       1  def exercicio4(n):
       2      return 'P' if n > 0 else 'N'