I have, after years of excuses, started programming. Well honestly, I was not able to find any one interested in helping me with my start-up idea. So I had no choice but to ask myself 'How hard can this be?' and here I am.
Here is a Python program for a simple calculator of my own budgets and savings. I have used basic Python concepts to write this code. The way I am learning is hands-on without theory as it immensely monotonous.(Suggest me some interesting 📚 too.)
Here is my code. I am curious to know what coding concepts I can use to make this a shorter, efficient and a better code. All the inputs will be genuinely respected.
salary = float(input("Enter your total salary per month: "))
savings = float(input("Enter your savings percentage: "))
emi = float(input("What is your total emi percent:"))
budget = float(input("how much do you want to save?:"))
duration = float(input("how many months do you have?:"))
tfinal = salary-((savings/100)*salary) #total salary left after savings are subtracted
final_left = tfinal-((emi/100)*salary) #total salary left after savings and emi removed
percent_left = 100-(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 \nearning {} rupees {} percent left and save {} rupees per month".format(final_left,percent_left,sav_per_month))
else:
print ("it is not possible \nearning {} rupees {} percent left and you want to save {} rupees per month?".format(final_left,percent_left,sav_per_month))
print "you will be left with:", final_budget