Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Anthony Nemetz1,717 Points
for 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.
Joseph YhuPHP Development Techdegree Graduate 48,463 Points
Are 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.