Transcript
Use with ChatGPT / Claude Auto-scroll A
the following content is provided under a Creative Commons license your support will help MIT open courseware continue to offer highquality educational resources for free to make a donation or view additional materials from hundreds of MIT courses visit MITopencourseware at
ocw.mit.edu so now we have this this last exercise I'm creating a my sum I'm going to go through all of these values and you guys have already told me what values these are 5 7 9 not 11 andI'm going to add to my sum so I'm going to keep a running sum adding all of these values together okay so the very first time through the loop my sum gets the value of five okay that's thisline here the next thing I'm I see inside this Loop is an if statement if my sum is equal to five that's true so I'm going to go inside this if statement the next thing I see is abreak if I see this break am I evaluating this am I evaluating this line or not no exactly because when whenever python sees break it's going to say I'm going to stop right here exit out of the loop
that I'm currently in and go to the statement that's immediately right after it so what this is going to print is my sum and that's the exercise we were looking at let's see how the class did pretty goodhopefully if you answered one of these um the explanation was was all right if not just go back and try to work through it step by step