On 5/24/22 15:14, Kevin M. Wilson via Python-list wrote: > future_value = 0 > for i in range(years): > # for i in range(months): > future_value += monthly_investment > future_value = round(future_value, 2) > # monthly_interest_amount = future_value * monthly_interest_rate > # future_value += monthly_interest_amount > # display the result > print(f"Year = ", years + f"Future value = \n", future_value)When joining > a string with a number, use an f-string otherwise, code a str() because a > implicit convert of an int to str causes a TypeError!Well...WTF! Am I not > using the f-string function correctly...in the above line of code???
As noted elsewhere, your f-strings by themselves are fine, it isn't complaining about those, though they're kind of silly as they don't do any formatting that justifies entering them as f-strings. It's complaining about this piece: years + f"Future value = \n" which is the second of the three comma-separated argument to print(). That's the int + string the error is grumping about. -- https://mail.python.org/mailman/listinfo/python-list