Ask HN: What is your best way to learn Python programming language?
I have no CS background. I want to learn Python as my first programming language.
So what's the best way to learn it and maybe the fastest?
So what's the best way to learn it and maybe the fastest?
14 comments
[ 2.8 ms ] story [ 41.3 ms ] threadBut, I still can't come up with a static language that I'd want to teach someone as a first language. C# would be a good choice, but I don't know how much success a beginner would have with .Net. Typescript is hard to debug unless you know Javascript. I wouldn't wish C++ as a first languge upon anyone. Haskell seems like it would be very frustrating for a beginner. Swift might be okay if they really badly wanted to go mobile, but that's not the case here. Rust is the best I can come up with, though it seems like a tough first language.
Do you have any ideas? I see the value of learning static first, but can't come up with a good language!
Personally, I have been in the role of teaching people programming, and I have seen what Java does to them. And I remember what it was like when I first encountered it.
So, I don't have a better suggestion if that is the goal. But if the goal is to learn programming, I have plenty to say on that. I worked as a TA for 3 years and from my rather biased experience, I would highly recommend HtDP and Racket.
I like to learn by doing projects. I'll usually pick three projects that I find somewhat interesting and figure out how to finish them with the new tool. I usually progress like this:
1.) Build the first project. 2.) Build the second project. 3.) Go back, read the first project and refactor it using what I've learned. 4.) Build the third project. 5.) Add a new feature to the first project. 6.) Refactor the second project. 7.) Add a new feature to the third project.
By the time I've made it through those steps, I'm fairly confident with my skills. I likely don't have full mastery of the language and it's ecosystem, but I have found good resources, learned where to ask for help, and learned enough of the ecosystem's language to be able to ask for more detailed help.
I also try to confine my learning to one subject. For example, you mention that you'd like to start doing some data analysis. If you have advanced knowledge in math/stats, that might be a great way to learn. But, if you don't, you'll have to learn the underlying science while you're learning to use the tool. With the way I learn, that is setting me up for failure.
Here is the thing though. My method works for me and I'm using it now to learn a new tool. But, I'm a sample of one.
A fellow named Zed Shaw has written a set of guides to learning new languages. His Learn Python the Hard Way is quite well regarded. Learning a language like that doesn't work as well for me, but that might be the exact way that you learn. To learn more, check out https://learnpythonthehardway.org . If you like taking notes, this might be a good option for you. Only, you might find that your muscle memory improves faster if you type the notes into a computer!
Alternately, there are some great classes that you can take online. MIT offers Introduction to Computer Science and Programming in Python through MITOpenCourseware and ItunesU. I already knew Python when I listened to that series, but I learned one hell of a lot through the lectures.
You'll still have to practice and write lots of code, but hopefully one of those resources helps you progress to the point that you feel your practice is beneficial. The key is to find a style that works for you and keep at it.
Programming is hard, so keeping at it is the most important part. It doesn't much matter how you learn as long as you don't quit. You'll learn the most when you're most frustrated, so take frustration as a sign that you're getting better. Depending on how you motivate yourself, you might want to keep a learning journal so that when you feel dumb you can flip back and realize that you were significantly dumber a month ago. :)
Good luck! And don't be afraid to ask for help. We have all been beginners and most really good developers are all beginners in something. Have fun and kick ass!
Depending on how you learn best, the following are 3 effective ways to learn:
From a book - one of the best books is Learning Python (http://shop.oreilly.com/product/0636920028154.do)
From videos - you could search YouTube for a trainer who communicates in a way that resonates for you.
By playing (and writing) games - PyGame is an excellent resource (https://www.pygame.org/docs/tut/PygameIntro.html)
Well written Python programs are like structured English, so they are not that hard to read. Personally I would suggest PyGame as the most effectively way to learn, but it really is a personal taste and preferences thing.
[1]: https://docs.python.org/3/tutorial/
I'd also recommend LPTHW [1] as complementary.
[1]: https://learnpythonthehardway.org
I'm surprised they finally caved in and moved to python3. They were really adamant against it.
Last release is from 2012 and uses Python 3 and it is freely available under GNU Free Documentation License.
Link: http://howtothink.readthedocs.io/en/latest/