Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAnthony Nemetz
1,717 Pointsfor grade in test_grade
All of the math concepts are familiar to me, The part I am lost with is where - for grade in test_grade: - somehow pulls the proper number of grades above 70. Is grades a specified term? is it a part of the code that I am not seeing? the percentages and math all make sense, I am just unaware what is telling this to go up and look for this properly.
thanks!
1 Answer
Joseph Yhu
PHP Development Techdegree Graduate 48,637 PointsAre you familiar with for loops?
for grade in test_grades:
if grade >= 70:
passed += 1
This is an example of a for loop in Python; grade
is just used as a reference to each item in the test_grades
list. First time through the loop, grade
would equal 98 because that's the first item in the list for example. Second time, grade
would equal 100, third time 54, etc.
Anthony Nemetz
1,717 PointsAnthony Nemetz
1,717 PointsThank you! That's what I was looking for