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
tresMayores = [] | |
numbers = [22, 21, 8, 5, 2, 1, 20] | |
tresMayores = [] | |
for i in range(3): | |
mayor = max(numbers) | |
tresMayores += [mayor] | |
numbers.remove(mayor) | |
print(tresMayores) |
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
class MyDict: | |
""" | |
*-------------------------------------------------------------------------- | |
* crea un diccionario personalizado con los mismos objectos y metodos | |
*-------------------------------------------------------------------------- | |
""" | |
def __init__(self, *args): | |
self.__values = [] | |
try: | |
for key, value in args: |
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
def mergesort(l): | |
""" | |
*-------------------------------------------------------------------------- | |
* metodo de ordenamiento ordenar y mezclar de forma recursiva | |
* http://es.wikipedia.org/wiki/Ordenamiento_por_mezcla | |
*-------------------------------------------------------------------------- | |
* l: es la lista que se desea ordenar | |
* @return: la lista ordenada | |
""" | |
if len(l) > 1: |
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
def scalar_sort(l): | |
""" | |
*-------------------------------------------------------------------------- | |
* ordena una lista de forma escalar | |
*-------------------------------------------------------------------------- | |
* l: la lista que se quiere ordenar | |
* @return: la lista ordenada | |
""" | |
if not l: | |
return l |
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
def my_list_sort(l): | |
""" | |
*-------------------------------------------------------------------------- | |
* ordena una lista de forma binaria | |
*-------------------------------------------------------------------------- | |
* l: es la lista a ordenar | |
* @return: retorna la lista ordenada en una etapa | |
""" | |
for i in range(len(l)): | |
try: |
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
<?php | |
return array( | |
/* | |
|-------------------------------------------------------------------------- | |
| Application Debug Mode | |
|-------------------------------------------------------------------------- | |
| | |
| When your application is in debug mode, detailed error messages with |
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
# functiona solo para python v3.0 o superior xD | |
frace = input("Ingrese una frace: ") | |
print("".join([e[0] for e in frace.split()]).upper()) |
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
from random import randint | |
def generar_vector(n): | |
''' | |
genera un vector con enteros aleatoreos entre 0-1000 de longitud n | |
''' | |
return [randint(0, 1000) for i in range(n)] | |
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
<?php | |
echo "hola DPW"; | |
?> |
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
def conflict(state, nextX): | |
nextY = len(state) | |
for i in range(nextY): | |
if abs(state[i]-nextX) in (0, nextY-i): | |
return True | |
return False | |
def queens(num=8, state=()): | |
for pos in range(num): | |
if not conflict(state, pos): |