sexta-feira, 28 de julho de 2017

The Zen of Python - Bubble Sort

def return_sorted_list(unsorted_list):
    sorted_list = unsorted_list[:]
    for i in range(0,len(sorted_list)):
        for i in range(0,len(sorted_list)):
                if i < (len(sorted_list) - 1):
                    current_item = sorted_list[i]
                    next_item = sorted_list[i+1]
                    if current_item > next_item:
                            sorted_list[i] = next_item
                            sorted_list[i+1] = current_item
    return sorted_list

print(return_sorted_list([3,4,2,6,7]))


sexta-feira, 21 de julho de 2017

DJANGO - TIME_ZONE = 'America/Sao Paulo'


Para corrigir o problema das três horas a mais.

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'America/Sao_Paulo'

USE_I18N = True

USE_L10N = True

USE_TZ = False