Skip to content

Instantly share code, notes, and snippets.

@shaikkhajaibrahim
Last active March 5, 2020 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaikkhajaibrahim/4d7e94f6512c8df228531716629a5edb to your computer and use it in GitHub Desktop.
Save shaikkhajaibrahim/4d7e94f6512c8df228531716629a5edb to your computer and use it in GitHub Desktop.
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
Copy link

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