Skip to content

Instantly share code, notes, and snippets.

@kaiquewdev
Last active August 29, 2015 14:27
Show Gist options
  • Save kaiquewdev/b3801aad0523937203ec to your computer and use it in GitHub Desktop.
Save kaiquewdev/b3801aad0523937203ec to your computer and use it in GitHub Desktop.
#coding:utf-8
#!/usr/bin/env python
values = []
total = None
def is_max(a, b):
return a >= b
def is_min(a, b):
return a <= b
def get_max(numbers):
out = 0
for number in numbers:
if is_min(out, number):
out = number
return out
def get_min(numbers):
out = numbers[0] or 0
for number in numbers:
if is_max(out, number):
out = number
return out
while True:
number = input("\nInsira um numero: ")
values.append(number)
pass_away = raw_input("\nContinuar inserindo? ")
if not pass_away == "S":
break;
total = len(values)
print '-' * 25
print 'Lista de valores: \n %s' % (values)
print 'Valor máximo: \n %s' % (get_max(values))
print 'Valor minimo: \n %s' % (get_min(values))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment