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
24 changes: 24 additions & 0 deletions Questao3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

def calculo_percentual(total,gasto):
percentual_gasto=(gasto/total)*100
return percentual_gasto

def calculo_ideal(percentual):
valor_ideal=(percentual*renda_mensal)/100
return valor_ideal

def diagnostico(percentual_gasto,gasto_ideal,local):
print(f"Seus gastos totais com {local} comprometem {percentual_gasto:.2f}% de sua renda total. O máximo recomendado é de {gasto_ideal}%.")
if percentual_gasto<=gasto_ideal:
print("Seus gastos estão dentro da margem recomendada.")
else:
print(f"Portanto ,idealmente, o máximo de sua renda comprometida com moradia deveria ser de R${calculo_ideal(gasto_ideal):.2f}.")

renda_mensal=float(input("Renda mensal total: R$"))
gastos_moradia=float(input("Gastos totais com moradia: R$"))
gastos_educacao=float(input("Gastos totais com educação: R$"))
gastos_transporte=float(input("Gastos totais com transporte: R$"))

diagnostico(calculo_percentual(renda_mensal,gastos_moradia),30,"moradia")
diagnostico(calculo_percentual(renda_mensal,gastos_educacao),20,"educação")
diagnostico(calculo_percentual(renda_mensal,gastos_transporte),15,"transporte")
16 changes: 16 additions & 0 deletions Questao4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

def coletar_dados():
valor_inicial = float(input("Valor inicial: R$"))
rendimento = float(input("Rendimento por período (%):"))
aporte_periodico = float(input("Aporte a cada período: R$ "))
periodos = int(input("Total de períodos:"))

calcular_juros(valor_inicial,rendimento,aporte_periodico,periodos)


def calcular_juros(valor,rendimento,aporte,periodo):
for i in range(periodo):
valor=valor+(valor*(rendimento/100))+aporte
print(f"Após {i+1} períodos(s), o montante será de R${valor:.2f} ")

coletar_dados()