In: Computer Science
python
College is an investment. Tuition can range from $3,000 to $20,000 for a full-time student per semester. It seems like every year the cost continues to increase. It has been announced that the average tuition will increase by 5 percent each year for the next 4 years. To help students manage the cost of college, write a program that allows the students to input their full-time tuition cost per semester and then using a loop displays the projected semester tuition amount for the next 4 years.
Ex.
Enter the full-time student tuition per semester:
5000
when 10000
Enter the full-time student tuition per semester: - In 1 year, the tuition will be $10500.00.
-In 2 years, the tuition will be $11025.00.
In 3 years, the tuition will be $11576.25.
here is what i got
def main():
amount=5000.0
print('Enter the full-time student tuition per semester:')
for i in range(1,5):
amount=amount+(amount*0.05)
if i is 0:
print('- In '+str(i)+' year, the tuition will be $'+str((amount))+'.')
elif i is 5:
print('- In '+str(i)+' years, the tuition will be $'+str(round(amount, 2))+'2.')
else:
print('- In '+str(i)+' years, the tuition will be $'+str(round(amount,2))+'.')
if __name__=="__main__":
main()
If you need any corrections, kindly comment
Program
def main():
amount=float(input('Enter the full-time student
tuition per semester:'))
for i in range(1,5):
amount=amount+(amount*0.05)
print('- In '+str(i)+"
years, the tuition will be ${:0.2f}".format(amount))
if __name__=="__main__":
main()
Output
Enter the full-time student tuition per semester:10000
- In 1 years, the tuition will be $10500.00
- In 2 years, the tuition will be $11025.00
- In 3 years, the tuition will be $11576.25
- In 4 years, the tuition will be $12155.06
Screenshot
