from locale import setlocale, LC_ALL, currency, localeconv
setlocale(LC_ALL, 'hi_IN.UTF-8')
symbol = localeconv()['currency_symbol']
print('Enter...')
salary = float(input(f'your monthly salary: {symbol}'))
savings = float(input('your monthly savings: %'))/100
emi = float(input('your equated monthly installment (EMI): %'))/100
budget = float(input(f'the total amount you want to save: {symbol}'))
duration = float(input('how many months you have: '))
def fmoney(money: float) -> str:
return currency(money, grouping=True)
tfinal = salary - savings*salary # total salary left after savings are subtracted
final_left = tfinal - emi*salary # total salary left after savings and emi removed
percent_left = 1 - savings - emi # total percentage of salary left after savings and emi removed in percent
final_budget = final_left*duration # monthly saving multiplied by duration for final amount left
sav_per_month = budget/duration # final budget savings you are planning per month
if sav_per_month < final_left:
print(
'It is possible.'
= 'possible'
f'\nEarning {fmoney(final_left)}can with= {percent_left'can'
else:.1%} left,'
possible = 'not f'possible'
you can save {fmoney(sav_per_month)}can per= month.')'cannot'
else:
print(
'Itf'It is not {possible}.'
f'\nEarning {fmoney(final_left)} with {percent_left:.1%} left,'
f' you cannot{can} save {fmoney(sav_per_month)} per month.'
)
print(f'Youf'\nYou will be left with {fmoney(final_budget)}.'
)