Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
invested_amount = input('Enter your invested amount')
return_amount = input('Enter the amount returned from investment')
months_count = input('Enter number of months it took for return')
profit = return_amount - invested_amount
print("profit/loss is {profit}")
net_profit_per_month = profit/months_count
yearly_profit = net_profit_per_month * 12
print('Return % per year is {yearly_profit}')
# Corrected/fixed
import pdb
invested_amount = int(input('Enter your invested amount = '))
return_amount = int(input('Enter the amount returned from investment = '))
months_count = int(input('Enter number of months it took for return = '))
# pdb.set_trace()
profit = return_amount - invested_amount
print(f"Absolute profit/loss is {profit} $")
net_profit_per_month = profit/months_count
avg_profit_per_month = (net_profit_per_month * 100/invested_amount)
print(f'Return % per month is {avg_profit_per_month}')
yearly_profit = avg_profit_per_month * 12
print(f'Return % per year is {yearly_profit}')
@rawatssns

This comment has been minimized.

Copy link

@rawatssns rawatssns commented Mar 5, 2020

invested_amount = int(input('Enter your invested amount'))
return_amount = int(input('Enter the amount returned from investment'))
months_count = int(input('Enter number of months it took for return'))
profit = return_amount - invested_amount
print(f"profit/loss is {profit}")
net_profit_per_month = profit/months_count
yearly_profit = net_profit_per_month * 12
print(f'Return % per year is {yearly_profit}')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment