Last active
June 27, 2018 06:45
-
-
Save magusafr/757f6991a34bffc18d406fa93e48a976 to your computer and use it in GitHub Desktop.
Financial Statement
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
#Data | |
revenue = [14574.49, 7606.46, 8611.41, 9175.41, 8058.65, 8105.44, 11496.28, 9766.09, 10305.32, 14379.96, 10713.97, 15433.50] | |
expenses = [12051.82, 5695.07, 12319.20, 12089.72, 8658.57, 840.20, 3285.73, 5821.12, 6976.93, 16618.61, 10054.37, 3803.96] | |
import numpy as np | |
profit_loss = [] | |
for i in range(0, len(revenue)): | |
profit_loss.append(revenue[i] - expenses[i]) | |
tax = [round(i * 0.3,2) for i in profit_loss] | |
profit_loss_after_tax = [] | |
for i in range(12): | |
profit_loss_after_tax.append(profit_loss[i] - tax[i]) | |
profit_margin = [] | |
for i in range(0, len(profit_loss)): | |
profit_margin.append(profit_loss_after_tax[i] / revenue[i]) | |
profit_margin = [round(i * 100, 2) for i in profit_margin] | |
mean = np.mean(profit_loss_after_tax) | |
mean = round(mean, 2) | |
good_months = [] | |
for i in range(12): | |
if profit_loss_after_tax[i] > mean: | |
good_months.append(profit_loss_after_tax[i]) | |
bad_months = [] | |
for i in range(12): | |
if profit_loss_after_tax[i] < mean: | |
bad_months.append(profit_loss_after_tax[i]) | |
best_month = np.max(good_months) | |
worst_month = np.min(bad_months) | |
revenue = [round(i,) for i in revenue] | |
expenses = [round(i,) for i in expenses] | |
profit_loss = [round(i,) for i in profit_loss] | |
profit_loss_after_tax = [round(i,) for i in profit_loss_after_tax] | |
good_months = [round(i,) for i in good_months] | |
bad_months = [round(i,) for i in bad_months] | |
best_month = int(best_month) | |
worst_month = int(worst_month) | |
print("Revenue: ") | |
for i in range(len(revenue)): | |
print("Month " + str(i+1) + " = " + str(revenue[i])) | |
print("\nExpenses: ") | |
for i in range(len(expenses)): | |
print("Month " + str(i+1) + " = " + str(expenses[i])) | |
print("\nMean profit or loss after tax") | |
print(mean) | |
print("\nThe profit or loss is:") | |
for i in range(len(profit_loss)): | |
print("Month " + str(i+1) + " = " + str(profit_loss[i])) | |
print("\nThe profit or loss after tax:") | |
for i in range(len(profit_loss_after_tax)): | |
print("Month " + str(i+1) + " = " + str(profit_loss_after_tax[i])) | |
print("\nThe profit or loss margin after tax :") | |
for i in range(len(profit_margin)): | |
print("Month " + str(i+1) + " = " + str(profit_margin[i]) + "%") | |
print("\nThe good months are:") | |
print(good_months) | |
print("\nThe bad months are:") | |
print(bad_months) | |
print("\nThe best month is:") | |
print("Month 12 = " + str(best_month)) | |
print("\nThe worst month is:") | |
print("Month 3 = " + str(worst_month)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment