Sip calculator
def sip_calculator(): print("\nSIP Calculator for Pakistan\n") print("This calculator estimates the future value of your monthly investments.") print("All amounts are in Pakistani Rupees (PKR).\n") try: # Get user inputs monthly_investment = float(input("Enter monthly investment amount (PKR): ")) investment_period = float(input("Enter investment period in years: ")) expected_return_rate = float(input("Enter expected annual return rate (%): ")) # Validate inputs if monthly_investment <= 0 or investment_period <= 0 or expected_return_rate <= 0: print("All values must be positive. Please try again.") return # Convert annual rate to monthly and percentage to decimal monthly_return_rate = (1 + expected_return_rate / 100) ** (1/12) - 1 total_months = investment_period * 12 # Calculate future value future_value = monthly_investment * (((1 + monthly_return_rate) ** total_months - 1) / monthly_return_rate) * (1 + monthly_return_rate) # Calculate total investment total_investment = monthly_investment * total_months # Calculate estimated returns estimated_returns = future_value - total_investment # Display results print("\nInvestment Summary:") print(f"Monthly Investment: PKR {monthly_investment:,.2f}") print(f"Investment Period: {investment_period} years ({total_months} months)") print(f"Expected Annual Return: {expected_return_rate:.2f}%") print(f"Total Investment: PKR {total_investment:,.2f}") print(f"Estimated Returns: PKR {estimated_returns:,.2f}") print(f"Future Value: PKR {future_value:,.2f}") # Display inflation-adjusted value (assuming 7% average inflation) inflation_rate = 7.0 # Average inflation rate for Pakistan inflation_adjusted_value = future_value / ((1 + inflation_rate/100) ** investment_period) print(f"\nInflation-Adjusted Value (at {inflation_rate}% inflation): PKR {inflation_adjusted_value:,.2f}") except ValueError: print("Invalid input. Please enter numeric values.") # Run the calculator if __name__ == "__main__": sip_calculator()
Comments
Post a Comment