Skip to content

Instantly share code, notes, and snippets.

@ricardosiri68
Last active May 4, 2016 02:59
Show Gist options
  • Save ricardosiri68/92c86ed5bc293a9aee798a2879f2cfe4 to your computer and use it in GitHub Desktop.
Save ricardosiri68/92c86ed5bc293a9aee798a2879f2cfe4 to your computer and use it in GitHub Desktop.
def sort_nums(nums=[], min_index=0):
if min_index < len(nums):
for i in range(len(nums)):
if nums[i] > nums[min_index]:
nums[i], nums[min_index] = nums[min_index], nums[i]
break
sort_nums(nums, min_index + 1)
def reserved_words(message="", words=[]):
message = message.lower()
for word in words:
if word.lower() in message:
return True
return False
if __name__ == "__main__":
# ejercisio 1
nums = [4, 3, 1, 2]
sort_nums(nums)
print(nums)
# ejercisio 2
message = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "\
"Nam non sapien augue. Aliquam nec quam nisl. Sed pulvinar turpis "\
"orci, vitae condimentum est feugiat vitae. Nunc venenatis tellus eu "\
"sodales sollicitudin. Ut nisi neque, molestie eu enim ut, aliquet "\
"suscipit velit. Ut gravida vitae mi eget tristique. Fusce posuere, "\
"nulla vitae vestibulum gravida, erat tortor interdum mauris, vel "\
"lobortis nisl purus vitae nibh. Cras ac purus felis planos. Cras "\
"elementum purus dapibus, faucibus quam sit amet, cursus leo. Integer "\
"non sollicitudin nibh. Suspendisse sodales ante id lorem blandit "\
"auctor. Vivamus venenatis ex et ex eleifend condimentum. Integer "\
"tempus, leo vitae mollis bibendum, erat ligula vulputate nisl, id "\
"sollicitudin leo nunc nec mauris. Phasellus tincidunt venenatis "\
"est. Nunc molestie fermentum sapien, ac dapibus massa molestie id. "\
"Mauris ut nisi ex."
words = ['planos', 'diseño', 'especificaciones', 'test', 'documentos',
'prototipo', 'demo', 'clientes', 'proveedor', 'componentes',
'materiales']
if reserved_words(message, words):
print('Guarda las cachasa !!! hay una palabra reservada en el msj')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment