How to learn Python

How to learn Python as a second language

How to learn Python as a second language.

After watching and reading few tutorials you still can’t say that you know much Python and that’s probably true.

How I try to learn it, still work in progress, is to use a project-based approach.

Learn the basics of the language.

1. No semicolons;

2. Indentation matters (a lot),

3. Use a library,

4. Slice,

5. Real life words do things in Python,

6. Types especially Lists and Dictionaries,

7. My personal favorite Use tabs to indent not spaces (this is a controversial one)

A project based way to learn is have small tasks that you can do in a Python script and do them without.

You can use LeetCode.com or HackerRank.com coding challenges or tasks and try to sole them in Python. A few popular easy level LeetCode solutions are:

You can try my solution or make one by yourself and if you use hints while doing it it’s fine. This is a quick way to learn more Python specific functions.

Also look at how others have solved them in Python and other languages and see if you can solve them in a better way and ideally that runs faster and uses less memory.

The best way is to write your code in the language that you are already familiar with and then translate it to Python.

There is a notion of code being Pythonic. That means to me the code is easy to write and especially easy to read and understand by someone else.



Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.