Settings

Theme

Ask HN: Exercises to learn new programming languages

1 points by jareds 10 months ago · 3 comments · 1 min read


Are there any good sites that provide exercises for learning a new programming language with out focusing on algorithms? I'm currently using AI tools with Python to write code with out much Python experience. While I can read and understand the code I feel like I have a surface level understanding of Python syntax. I'd like to go through exercises that focus on language features like loops, maps, etc, instead of algorithm focused sites such as LeetCode.

pvg 10 months 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.

pestatije 10 months ago

https://docs.python.org/3/tutorial/index.html

zahlman 10 months 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.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection