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
# Variables | |
GIT_CURRENT_BRANCH := ${shell git symbolic-ref --short HEAD} | |
BASE_DIR := ./ | |
PKG_NAME := src | |
SRC_DIR := $(BASE_DIR)/$(PKG_NAME)/ | |
PYTHONPATH := ${shell pwd} | |
init: | |
@PYTHONPATH=$(PYTHONPATH) python manage.py db init | |
migrate: |
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 dateutil.parser import parse | |
date1 = parse('2006-01-02T15:04:05) | |
date2 = parse('2006-01-02 15:04:05) | |
date3 = parse('02/01/2006 15:04:05) |
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 datetime import datetime | |
datetime_obj1 = datetime.strptime('2006-01-02T15:04:05', '%Y-%m-%dT%H:%M:%S') | |
datetime_obj2 = datetime.strptime('2006-01-02 15:04:05', '%Y-%m-%d %H:%M:%S') | |
datetime_obj3 = datetime.strptime('02/01/2016 15:04:05', '%d/%m/%Y %H:%M:%S') |
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 statistics import mean | |
meses = [ | |
'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', | |
'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro' | |
] | |
medias = {} | |
for mes in meses: |
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
n = 11 | |
while n < 0 or n > 10: | |
n = int(input("Digite um número entre 0 e 10: ")) | |
def factorial(n): | |
if n < 1: # base case | |
return 1 | |
else: | |
return n * factorial(n - 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
valor = int(input("Digite o valor: ")) | |
cedulas = [100, 50, 20, 10, 5, 2, 1] | |
notas = {} | |
for cedula in cedulas: | |
if valor >= cedula and valor > 0: | |
notas[cedula] = valor // cedula | |
valor -= notas[cedula] * cedula |
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
# Conversão de Binário para decimal | |
num = input('Digite o número binário: ') | |
resultado = [] | |
for i in range(len(num)): | |
if int(num[::-1][i]) == 1: | |
resultado += 2 ** i | |
print(resultado) |
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
listaNotas = [] | |
soma = 0 | |
media = 0 | |
for count in range(10): | |
nota = int(input('Digite as notas: ')) | |
listaNotas.append(nota) | |
soma = soma + nota | |
media = soma / len(listaNotas) | |
for nota in listaNotas: | |
if nota > media: |
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
hora = int(input("Informe a hora com dois digitos")) | |
if hora >=0 and <=11: | |
print("Bom dia") | |
elif hora >=12 and <=17: | |
print("Boa Tarde") | |
else: | |
print("Boa Noite") |
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
import psycopg2 | |
class Pessoa: | |
"""Classe de criação do objeto Pessoa""" | |
def __init__(self, nome, idade, sexo): | |
"""Inicializador dos atributos de instancia""" | |
nome = nome | |
idade = idade | |
sexo = sexo |
NewerOlder