Optional (Step 19) - Write methods that determine both the lowest or highest class grade


Maybe it's because I haven't had coffee in 3 days but I cannot think of how to implement this. Then again, even though I've got the code finally working for this project, I'm barely grasping how the for each loop works. Like I get it but when I try to to tack it all together in my head I just don't understand how it works, haha, if that makes sense. Anyways

Can someone throw me some idea how the methods for "Optional (Step 19)" would look/work?

// No code, no spoilers


This is pseudo code...

highest = 0
foreach value in sample
    if value > highest
        highest = value

lowest = highest
foreach value in sample
    if value < lowest
        lowest = value

print lowest, highest


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.