For this exercise using Python you will calculate college tuition increase. Current tuition per year averages $25,000. Over the next 5 years tuition will increase 2.5%. Your application should loop through values during this period and provide a print similar to the following. Year 1: $25,000 Year 2: $25,625 Year 3: $26,276.63 Year 4: $26,933.54 Year 5: $27,606.88
print(f" {variable} ") is used for formatting.
Last line of the code shows only 2 decimal points ie {:.2f}
{current_tut_fees:,} shows commas in currency
current_tut_fees=25000
percent_inc=2.5
for i in range(1,6):
print(f"Year {i}: ${current_tut_fees:,}")
current_tut_fees+=current_tut_fees*2.5/100
current_tut_fees=float("{:.2f}".format(current_tut_fees))
Output:-
Get Answers For Free
Most questions answered within 1 hours.