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.
5 changes: 5 additions & 0 deletions exercicios/para-casa/data_util/ano_bissexto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def ano_bissexto(ano):
if (ano % 4 == 0) and (ano % 100 != 0) or (ano % 400 == 0):
return True
else:
return False
4 changes: 4 additions & 0 deletions exercicios/para-casa/data_util/calculo_idade.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def idade(ano_nascimento):
ano_nascimento = int(ano_nascimento)
idade = 2023 - ano_nascimento
return idade
Empty file.
8 changes: 8 additions & 0 deletions exercicios/para-casa/resultados.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from data_util import calculo_idade
from data_util import ano_bissexto

ano_nascimento = 1991
ano = 2024

print(calculo_idade.idade(ano_nascimento))
print(ano_bissexto.ano_bissexto(ano))
13 changes: 13 additions & 0 deletions exercicios/para-sala/exemplo-pacote/calculadora,py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from matematica import soma
from matematica import subtracao
from matematica import multiplicacao
from matematica import divisao


a = 10
b = -5

print(soma.soma(a,b))
print(subtracao.subtracao(a,b))
print(multiplicacao.multiplicacao(a,b))
print(divisao.divisao(a,b))
5 changes: 5 additions & 0 deletions exercicios/para-sala/exemplo-pacote/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from pacote_mari import modulo_mari

info = modulo_mari.main()
print(info)

Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions exercicios/para-sala/exemplo-pacote/matematica/divisao.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def divisao (a,b):
if b > 0:
return b / a
else:
return 'impossível dividir'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def multiplicacao (a, b):
return a * b
2 changes: 2 additions & 0 deletions exercicios/para-sala/exemplo-pacote/matematica/soma.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def soma(a, b):
return a + b
2 changes: 2 additions & 0 deletions exercicios/para-sala/exemplo-pacote/matematica/subtracao.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def subtracao (a,b):
return a - b
Empty file.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def main():
return "são 03:51 da manhã e eu tô exausta mas não vou desistir"

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Eu vou conseguir entregar todas as tarefas da Reprograma e vou realizar esse sonho porque eu mere�o e foda-se tudo.
1 change: 1 addition & 0 deletions exercicios/para-sala/exercicios-manipulacao/dados.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nome": "Victor", "idade": 30, "profiss\u00e3o": "vendedor"}
6 changes: 6 additions & 0 deletions exercicios/para-sala/exercicios-manipulacao/exercicio1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
with open('.testeCriandoArquivoDoZero.txt', 'w') as teste:
teste.write("Eu vou conseguir entregar todas as tarefas da Reprograma e vou realizar esse sonho porque eu mereço e foda-se tudo.")

with open('.testeCriandoArquivoDoZero.txt', 'r') as teste:
conteudo = teste.read()
print (conteudo)
14 changes: 14 additions & 0 deletions exercicios/para-sala/exercicios-manipulacao/exercicio2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import json

dicionarioTeste = {
'nome': 'Victor',
'idade': 30,
'profissão': 'vendedor'
}

with open ('dados.json', 'w') as dados_json:
json.dump(dicionarioTeste, dados_json)

with open('dados.json', 'r') as dados_json:
dicionarioTeste = json.load(dados_json)
print(dicionarioTeste)
25 changes: 25 additions & 0 deletions exercicios/para-sala/exercicios-manipulacao/exercicio3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import csv

alunos = [['Chimichanga', '1', 10], ['Tori','6', 10], ['Victor', '30', 0]]

with open('notasAlunos.csv', 'w', newline='') as notas_csv:
escritor_csv = csv.writer(notas_csv)
escritor_csv.writerows(alunos)

with open('notasAlunos.csv', 'r', newline='') as notas_csv:
leitor_csv = csv.reader(notas_csv)

total_notas = 0
total_alunos = 0

for linha in leitor_csv:
nome, idade, nota = linha
nota = float(nota)
total_notas += nota
total_alunos += 1

media = total_notas / total_alunos
print (media)



3 changes: 3 additions & 0 deletions exercicios/para-sala/exercicios-manipulacao/notasAlunos.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Chimichanga,1,10
Tori,6,10
Victor,30,0
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', 'w') as arquivos: #read
# # # conteudo = arquivos.read()
# # # print (f' {conteudo} - Aluna Atrasada')

# # # linha = arquivos.readline()
# # linhas = arquivos.readlines()

# # # print(linha)
# # print(linhas[2])

# arquivos.write("fim de linha")

# informacoes = [['nome', 'idade'], ['Chimichanga', '1'], ['Tori','6'], ['Victor', '30']]

# with open('planilha.csv', 'w', newline='') as planilha_csv:
# escritor_csv = csv.writer(planilha_csv)
# escritor_csv.writerows(informacoes)

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

import json

informacoes = {'nome': 'Chimichanga', 'idade': 1, 'raca':'Salchihuahua'}

# with open('planilha.json', 'w') as planilha_json:
# json.dump(informacoes, planilha_json)

with open('planilha.json', 'r') as planilha_json:
informacoes = json.load(planilha_json)
print(informacoes)

4 changes: 4 additions & 0 deletions exercicios/para-sala/planilha.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
nome,idade
Chimichanga,1
Tori,6
Victor,30
1 change: 1 addition & 0 deletions exercicios/para-sala/planilha.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nome": "Chimichanga", "idade": 1, "raca": "Salchihuahua"}