amount = input("Enter the principal amount: ") amount = float(amount) rate = input("Enter rate percentage: ") x = input("Press '1' for time in days '2' for time in months and '3' for time in years.") if(x == 1): time = input("Enter number of days: ") time = time / (12 * 30) elif(x == 2): time = input("Enter number of months: ") time = time / 12 else: time = input("Enter number of years: ") total_amount = amount * (1 + (float(rate) / 100) ** time) print("Total_amount: ", total_amount)