funcoes para la e para ca.pptx - A Dana das Funes Geraldo...

Info icon This preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
A Dança das Funções Geraldo Xexéo
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Programas chama funções Os programas reais precisam de usar várias funções As funções também chamam funções
Image of page 2
Chamadas simples
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Chamadas encadeadas
Image of page 4
Saídas e Entradas Ao ler uma especificação de programa ou função você deve procurar Que dados estão disponíveis São as nossas entradas Que saídas são necessárias São as nossas sáidas
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Como calcular a saída Muitas vezes programamos do fim para o início Exemplo Faça um função que tenha como argumentos o lado da base e a altura de uma pirâmide de base quadrada calcule seu volume Entradas: lado da base, altura Saída: volume
Image of page 6
Resolvendo Tenho lado da base, altura Preciso: volume Qual o volume da pirâmide? Fórmula do volume área da base x altura / 3 Mas qual a área da base? Área de um quadrado base 2
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
MÓDULOS
Image of page 8
Bibliotecas Normalmente falamos de bibliotecas de funções Essas bibliotecas são coleções de funções úteis que podemos usar, normalmente juntas Em Python estão divididas em módulos
Image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Uma biblioteca simples
Image of page 10
Módulos Python implementa bibliotecas como módulos “module” Módulos fornecem conjuntos de funções Algumas funções vem no módulo básico, que já está carregado Outros módulos precisam ser carregados
Image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Quem está no módulo básico?
Image of page 12
Importando um Módulo import modulo Importa as funções do módulo, que devem ser chamadas como modulo.funcao import math a=math.sin(2) from modulo import *
Image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern