Last active
August 29, 2015 14:22
-
-
Save cpappen/3a67b0d87a91eac0a3d6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def soma (numeros): | |
inteiro = list(int(a) for a in numeros) | |
return sum(inteiro) | |
def quantidade (numeros): | |
return len(numeros) | |
def menor(numeros): | |
return min(numeros) | |
def maior(numeros): | |
return max(numeros) | |
def media(numeros): | |
return soma(numeros)/len(numeros) | |
def main(): | |
numeros=[] | |
print "> " | |
numeros = raw_input().split(",") # adiciona numeros separados por , ex: 1,4,19,-12 | |
print numeros | |
print "quantidade: ", quantidade(numeros) | |
print "menor: ", menor(numeros) | |
print "maior: ", maior(numeros) | |
print "media: ", media(numeros) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment