3 comments

  • pvg 7 hours ago

    The official Python tutorial is like that as are many of the more 'traditional' Python books and guides, with many focusing on exercises for the just-covered material. Somewhat out of style these days but they are plentiful.

  • zahlman 2 hours ago

    The other replies (two at time of writing) suggested the tutorial built in to the Python documentation, specifically for Python, and I'd recommend it as well.

    If you specifically want to practice using language features, you could start by taking a LeetCode etc. problem you find easy, and deliberately trying to write the code in different ways.

    Oh, but take out the boilerplate that they want you to use for their automated testing. Test it yourself at the REPL, and make sure you have a good idea for what sorts of inputs to test with (and that you know what output to expect).

    And, if you're feeling adventurous, read through the documentation for the `unittest` standard library and figure out how to test it yourself. Then look up Pytest and try to use that instead.

    But you might be better served by trying to think of your own exercises, honestly.

  • pestatije 7 hours ago