Created
August 27, 2020 21:51
-
-
Save mfurquimdev/ce12bfcaf52dca6db4d77006550d7dee to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/python | |
| mensalidade=400 # R$400 | |
| dias=21 # 21 dias úteis no mês | |
| transporte=3.5*2*dias # R$3,50 por ônibus, ida e volta (x2) | |
| monthly_spent=mensalidade+transporte # Dinheiro gasto no mês com este propósito | |
| daily_yield=0.02 # Objetivo diário de ganho 3% | |
| initial_ammount=1000 # Começando com R$1000 | |
| monthly_earnings=0 | |
| for initial_ammount in range(1000,10000,100): | |
| monthly_earnings=0 | |
| for i in range(0,dias): | |
| #monthly_earnings+=(initial_ammount+monthly_earnings)*daily_yield # Composto | |
| monthly_earnings+=initial_ammount*daily_yield # Simples | |
| if monthly_earnings - monthly_spent > 0: | |
| break | |
| print("Com a mensalidade a R$ {}, e operando na bolsa {} dias no mês, o gasto com transporte é R$ {}. Com um ganho de {}% diário, aplicando R$ {} por dia, temos um ganho de R$ {} ao final dos {} dias.\n".format(mensalidade, dias, transporte, daily_yield*100, initial_ammount, round(monthly_earnings,2), dias)) | |
| print("Monthly earnings: R$ {}\nMonthly spend: R$ {}\nMonthly net: R$ {}\n".format(round(monthly_earnings,2),round(monthly_spent,2), round(monthly_earnings - monthly_spent,2))) | |
| print("Nota: estou desconsiderando a alimentação.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment