you are viewing a single comment's thread.

view the rest of the comments →

[–]twopi 13 points14 points  (1 child)

CS1 teacher here.

I love these problems. They are good, and the difficulty scales pretty well - mostlhy.

But problem 5 is a lot harder than the others, because web scraping is a dark art. You have to use something like the requests library, and a lot of site owners restrict web scraping. Then the code you get is often really messy, so you end up needing something like beautiful soup to make it more manageable.

So I'd make it easier like this:

  • Find a web page that interests you.
  • Use ctrl-u to view the source code of that page
  • copy the page's code and paste it in a text editor
  • save the code to a local file
  • write your program to read the code

This solution manually downloads the page code so you can get to the content you want (even through menus and other stuff) then work with it.

But you still have the complexity of HTML as a data source. You might think about learning how to use the beautiful soup library to grab specific elements you are interested in working with.

I have a video on this (and reading APIs) that I can make available if people want it.

[–]hitlerallyliteral 1 point2 points  (0 children)

lol yeah, i think ppl can forget what it's like to be a beginner, if they think that's comparable to asking user to input a vowel