Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Crawl Web Loop - Intro to Computer Science

Get Embed Code
2 Languages

Showing Revision 5 created 05/25/2016 by Udacity Robot.

  1. The next step is to write the loop that's going to do
  2. the crawling. And we said the process we want to follow is
  3. to keep going as long as there are more pages to
  4. crawl. We can do that with a while loop, and we
  5. can use tocrawl like this in our test condition. If a
  6. list is empty that's interpreted as false. If the list is
  7. not empty, that would be interpreted as true. So this means
  8. the same thing as testing if the length of the list
  9. is zero, it's a cleaner way to write this by
  10. just doing while tocrawl. Inside the loop, well, we want to
  11. pick a page to crawl. We'll store that in the
  12. variable page. And I'll leave it as a quiz for you
  13. to figure out a way to pick the page to
  14. crawl. There's certainly lots of different ways to do this. If
  15. you're clever and can think about using all the things that
  16. we learned about, you'll be able to have one line that
  17. both initializes page to the next page we want to
  18. crawl, and removes that page from the tocrawl list.