# Week 4 Ex 5: This program projects tuition costs per semester for 5 years (10 semesters)at 2% increase per year # Written by Greg Lamb. # Last modified on 04/15/2015 #Set constants rateIncrease = .02 #per year tuition = 6000 #dollars/semester #Calculate tuition increase tuitionIncrease = (tuition * 2) * rateIncrease / 2 #Calculate cost per semester semesterTuition = (tuition + tuitionIncrease) print "Tuition Semester 1: $%.2f" % semesterTuition for semester in range (2, 11): semesterTuition = + (semesterTuition + tuitionIncrease) print "Tuition Semester {}: $%.2f" .format(semester) % semesterTuition
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question