lec-10-28 - break Ends the whole loop while True reply =...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
10/27/2009 1 ECS 10 10/26 break Ends the whole loop. while True: reply = raw input(“Enter Y or N: “) reply = raw_input( Enter Y or N: ) if (reply == “Y”) or (reply == “N”): break print “You answered”,reply,”.” continue Goes back to the top of the loop. string = “3,492,043” for char in string: if char == “,”: continue output = output+char print output What’s the difference? break goes DOWN; breaks the whole loop. continue goes UP; continues the loop. Both can be tricky to use, and they both make your programs harder to decipher your programs harder to decipher. Database Let the user look up specific piece of data. Example: state populations. What is the population of Oregon? One way to do it: User picks a state for line in stateFile: if state in line: find population This does not “scale up” When there is one question per program and the list of data is short, this is an OK plan. But what if SISWeb worked like this? Every time you wanted to check if a course was full, it would have to read the whole catalog.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern