Skip to content

Learn to Program with Python

pythonprogramming-group edited this page Nov 12, 2018 · 16 revisions

Feel free to comment, constructively criticize. Helpful comments will be added to the this, but my aim is to keep this short but still informative

How to learn to program is one of the most asked questions on programming forums, reddit’s various programming subreddits, here in our group too, etc. I am still learning myself, learning is a life long concept for programmers. There are much more smarter people than me, but this is a question that gets asked, so here are my thoughts. Reddit, has a general learnprogramming subreddit, that addresses this and other FAQs that is very impressive. I will use some of it here and apply it to Python. "There is no universally agreed way of learning to code -- everybody prefers learning in a slightly different way, and you may need to do some experimenting to find an approach that works best for you."

Pick one primary source to learn from, this source should be comprehensive. There is no quick way to learn. If you pick something else, you will miss key fundamentals of Python. Many newcomers get caught up in a trap of finding the best book, video. There are is no best, there are many good ones.

tl;dr

  1. Install Python 3.7, make certain you set the path if you are installing on Windows;
  2. Choose a way to create/edit Python code; and
  3. Select a source of learning

Longer Version...

  1. Install Python 3 from the official website, Python 2 is coming to the end of its life, it served us well but it now considered legacy. Ignore any suggestions that Python 3 is not as good as Python 2;
    Notes for Windows Users:
    1). Do not install Python 3.4, if you encounter errors, update your computer;
    2). When you run the Python installer, right click + shift and "Run as Administrator"; and
    3). Make certain you check the option to add Python to your system path.

  2. Pick a program to edit your code, there are various options.
    1). Python comes with Idle which you can use to edit code;
    2). A Code/Text editor, examples include Notepad++, Atom, Sublime Text 3, Vim. Many professional programmers use code editors, and most can be configured/customized for Python;
    3). An Integrated Development Editor, examples of this include PyCharm, Geany, Visual Studio Code. If you choose this option be prepared to learn how the IDE works. An IDE can be complex, and without understanding it you will easily get frustrated.

If you need help setting up your environment, this is a great place to go, The Hitchhiker’s Guide to Python;

  1. Go to the Python website, look at the FAQ, the Python 3 documentation. When you have a question that cannot be answered by your chosen source of learning go to documentation.

  2. Read Python's Style Guide PEP8, PEP8 is short but it will help you immediately. Adhering to PEP8 will save you hours of frustration;

  3. If you get an error, read it examine it closely. Python will attempt to help you identify errors, also known as the traceback. Search Google, if there is an exact error, use this as your search;

  4. If you are still stuck after trying, ask for help;

  5. Once you start learning programs that need logic, use a pen and paper to solve the problem first. Then code it out; and.

  6. Experiment, be inquisitive, if you want to find out what something does, just try it. Open up the python shell(this is not the same as IDLE) and try it.

Websites

  1. Official Python 3 Tutorial https://docs.python.org/3/tutorial/

Books

Video - Note: If you pick this approach you will need to use a Python reference like the Python 3 documentation and use google search

  • coursera.org
  • MIT Introduction to Computer Science and Programming in Python
  • Microsoft Virtual Academy Python tutorial
  • Sololearn, CodeAcademy - these places are good for practice, but they are not comprehensive. If you complete official Python Tutorial vs CodeAcademy, you will have a much more in depth knowledge of the Python Programming Language.
  1. "Find some small problem or project that you're interested in tackling. You could try building a tool to solve a small problem in your life, or try implementing a program you find interesting from scratch. This project will help motivate you to continue to learn to code and will give you opportunities to practice applying what you're learning. Supplement that resource by searching the web and asking questions. Eventually complete several non-trivial projects using that language."

  2. Here are some things they [and we] recommend you avoid doing: "Don't just simply passively follow along whatever resource you're using. Do the exercises and homework assignments; practice is an absolutely essential part of learning to code. Don't stop learning once you've completed a tutorial. Programming is the kind of field where there's always something new to learn."

Reddit's Learn Programming has a very comprehensive guide on Getting Started, if you still need more

https://www.reddit.com/r/learnprogramming/wiki/faq#wiki_getting_started