HACKER Q&A
📣 deathofsocrates

What is the best way to learn Python fast?


I need a fast approach to learn Python to be able to read and understand undocumented code, and able to start writing unit tests. I'm not an expert programmer. Started my journey with Java, worked on couple of micro services then moved to Javascript & Typescript. I'm sure the average programming experience here is way more than mine hence asking your kind help to guide me and share your fav resources. All links and comments are highly appreciated. Thank you in adv. HN Community!


  👤 daniel-s Accepted Answer ✓
The official tutorial https://docs.python.org/3/tutorial/

IMO, the best, most efficient way to learn.


👤 jventura
You can check this course I made recently [0]. It has lots of exercises you can use to practise as you go along.

In the resources [1] you can also find my full-speed python ebook. I use it to teach python to 2nd year CS students so they start programming with sockets after 3 weeks (~10 hours). You can stop after the classes chapter and you’ve learned basic python..

[0] https://pylearners.com/courses/python-intro/

[1] https://pylearners.com/resources/


👤 ralston3
My next question would be "What type of Python are you trying to learn". I personally feel there are multiple types:

- Enterprise web dev? You'll probably want Django https://dev.to/vladyslavnua/how-to-build-a-django-web-app-fr... (but ignore all the CSS, frontend stuff)

- Just want to learn idiomatic Python in general. Go through this article/exercise, write all the code, and research the topics that seem confusing, I think you'll be in good shape (ignore all the maths, just talking about the literal code) https://karpathy.github.io/2021/06/21/blockchain/

- Want to learn modern, idiomatic Python via a popular open source package? Look at this httpx code, and obviously playing around with a simple web client can be fun https://github.com/encode/httpx/blob/master/httpx.


👤 snbk97
Since you have past experience in debugging and working on other languages, you wont face much problem with python. The issue you might face with is adapting to framework or other similar tools used in python projects. Python reads pretty close to english, but there could be some surprising bits of code which might be surprising (list comprehesions, idiomatic code, weird decorator functions etc).

👤 PaulHoule
I like the Python course on HackerRank.

I also believe that the Python manual is top quality and that one of the best productivity strategies is to bypass StackOverflow and Google completely and to train yourself to look up anything in the manual which is possible to look up in the manual.


👤 methusala8
Related question asked a month ago:

https://news.ycombinator.com/item?id=29318263