Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions exercicios/para-casa/data_util/ano_bissexto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#Contém uma função eh_ano_bissexto(ano) que verifica se um ano é bissexto e retorna True ou False
# Exercício feito em grupo

def eh_ano_bissexto(ano):
# ano = int(input('Informe o ano para saber se é ou não bissexto: {}'))
if (ano % 4 == 0) and (ano % 100 != 0) or (400 == 0):
return True
else:
return False

14 changes: 14 additions & 0 deletions exercicios/para-casa/data_util/calculo_idade.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contém uma função calcular_idade(data_nascimento) que recebe uma data de nascimento como argumento e retorna a idade da pessoa
from datetime import datetime, timedelta

def calcular_idade(data_nascimento):
hoje = datetime.now()
idade = hoje - data_nascimento
return idade

dia_nascimento = int(input('Informe seu dia de nascimento: '))
mes_nascimento = int(input('Informe seu mês de nascimento: '))
ano_nasicmento = int(input('Informe seu ano de nascimento: '))
data_nascimento = datetime(day=dia_nascimento, month=mes_nascimento, year=ano_nasicmento)
idade = calcular_idade(data_nascimento)
print(idade) # Resultado em dias e horas. Como converter para anos?
12 changes: 12 additions & 0 deletions exercicios/para-casa/data_util/formatar_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from datetime import datetime

def formatar_data(data_original):
data_formatada = datetime.strptime(data_original, '%d/%m/%Y')
return data_formatada.date()

dia = (input('Informe o dia desejado: '))
mes = (input('Informe o mês desejado: '))
ano = (input('Informe o ano desejado: '))
data_original = dia + '/' + mes + '/' + ano
data_formatada = formatar_data(data_original)
print(data_formatada)
19 changes: 19 additions & 0 deletions exercicios/para-casa/estudos_semana_09.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from datetime import datetime, timedelta

# Manipulando datas

hoje = datetime.now()
print(hoje) # fornece a data e o horário
print(hoje.date()) # fornece somente a data, sem o horário, no formato aaaa/mm/dd
print(hoje.day)

# Fazendo contas com as datas
# Necessário importar o método timedelta

amanha = hoje + timedelta(days=1)
print(amanha)

## CRIANDO UMA DATA ESPECÍFICA

data_contrato = datetime(year=2022, month=9, day=1)
print(data_contrato.date())
5 changes: 5 additions & 0 deletions exercicios/para-casa/projeto_principal_lais.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Exercício feito em grupo
from data_util import ano_bissexto

ano = int(input('Informe o ano que deseja verificar: '))
print(ano_bissexto.eh_ano_bissexto(ano))
Empty file added exercicios/para-sala/alunos.csv
Empty file.
1 change: 1 addition & 0 deletions exercicios/para-sala/dados.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"nome": "Alice", "idade": 30, "cidade": "Exemploville"}, {"nome": "Larissa", "idade": 25, "cidade": "Guaruja"}]
2 changes: 2 additions & 0 deletions exercicios/para-sala/dados.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Oie estou fazendo curso de python
Uhuuuu
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from matematica import calculo

a = 3
b = 2

print(calculo.soma(a,b))

print(calculo.subtracao(a,b))

print(calculo.multiplicacao(a,b))

print(calculo.divisao(a,b))

Empty file.
12 changes: 12 additions & 0 deletions exercicios/para-sala/exercicios_pacotes/matematica/calculo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def soma(a,b):
return a + b

def subtracao(a,b):
return a - b

def multiplicacao(a, b):
return a * b

def divisao(a,b):
return a / b

36 changes: 36 additions & 0 deletions exercicios/para-sala/manipulacao-arq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# import csv

# with open ('./dados.txt', 'r') as file:
# content = file.read()
# print(content)

# dados = [['nome', 'idade']], [['Alice', 30]], [['Bob', 25]]

# with open('pessoas.csv', 'w', newline='') as arq_csv:
# escritor_csv = csv.writer(arq_csv)
# escritor_csv.writerows(dados)

# with open('pessoas.csv', 'r', newline='') as arq:
# leitor_csv = csv.reader(arq)
# for linha in leitor_csv:
# print(linha)

# import json

# dados = {'nome': 'Alice', 'idade': 30, 'cidade': 'Exemploville'}, {'nome': 'Larissa', 'idade': 25, 'cidade': 'Guaruja'}

# with open('dados.json', 'w') as arquivo_json:
# json.dump(dados, arquivo_json)

# with open('dados.json', 'r') as arquivo_json:
# dados = json.load(arquivo_json)
# print(dados)

import csv

with open('./alunos.csv', 'w') as arq_csv:
leitor_csv = csv.reader(arq_csv)




3 changes: 3 additions & 0 deletions exercicios/para-sala/pessoas.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"['nome', 'idade']"
"['Alice', 30]"
"['Bob', 25]"