Created
April 18, 2014 17:35
-
-
Save samueltcsantos/11055525 to your computer and use it in GitHub Desktop.
Funções em Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Created on 18/04/2014 | |
@author: Samuel T. C. Santos | |
Criando funcoes em Python | |
''' | |
def soma(a, b): | |
return a + b | |
def multiplica(a,b): | |
return a * b; | |
def menor(a,b): | |
if a < b: | |
return a | |
else: | |
return b | |
def ehPar(numero): | |
return numero % 2 == 0 | |
print "Soma de 9 +11 = " , soma(9,11) | |
print "Multiplicao de 4 * 9 = " , multiplica(4,9) | |
print "Menor entre 9 e 11 = ", menor(9,11) | |
print "Eh par 19 = ", ehPar(19) | |
print "Eh par 22 = ", ehPar(22) | |
''' | |
Saida do Programa: | |
Soma de 9 +11 = 20 | |
Multiplicao de 4 * 9 = 36 | |
Menor entre 9 e 11 = 9 | |
Eh par 19 = False | |
Eh par 22 = True | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment