+ 1

I need help on python with the finance app practice

I’ve been stuck in a loop and can’t figure out where did I go wrong https://sololearn.com/compiler-playground/cXT9pOcSCq6a/?ref=app

18th Sep 2023, 12:01 AM
Nicot
5 Answers
+ 10
Nicot # Convert the user input into a float value and update the variable * you forgot to put savings inside the parentheses f_savings = float(savings) # Convert the balance into a string and update the variable * you hard-coded the 157.50 as the balance verses letting the code pass the variable balance value s_balance = str(balance)
18th Sep 2023, 1:17 AM
BroFar
BroFar - avatar
+ 4
Awesome, it worked. Thank you!
18th Sep 2023, 1:26 AM
Nicot
+ 3
You're welcome Nicot
18th Sep 2023, 1:28 AM
BroFar
BroFar - avatar
+ 2
you're getting a syntax error... check over your code for anything missing... and are you wanting input twice?
18th Sep 2023, 12:08 AM
Aaron Lee
Aaron Lee - avatar
0
def main(): compounder() def compounder(): new = '\n' p = float(input()) # principal, initial balance r = float(input()) # percent form, e.g. input for 2.5%: 2.5 y = float(input()) # years a = p * (1 + r / 100)**y # amount = principle(1 + rate/100)^years g = a - p # net gain if y <= 1: print(f'Initial Balance: ${p:,.2F}{new}Rate: {r:,.2F}%{new}Balance at {y:,.2F} Year: ${a:,.2F}{new}Gain: ${g:,.2f}') elif y > 1: print(f'Initial Balance: ${p:,.2F}{new}Rate: {r:,.2F}%{new}Balance at {y:,.2F} Years: ${a:,.2F}{new}Gain: ${g:,.2f}') else: print('There must be a strategic error on your end!') if __name__=='__main__': main()
19th Sep 2023, 7:13 PM
Jonathan Brooks
Jonathan Brooks - avatar