Learning Python
Published: 2020-04-24 22:57:55

Greetings,

Learning a new language may be daunting to many. A great deal of developers would say, "master one language, then go to another". I say that you should learn a great deal of basics then continue to go forward if you like. If not, then go with another. Moral... just keep learning. So today I am jumping into the learning of Python. Throughout the learning of python, I will blog about the practices of such. Well with that being said, let's not waste anytime.

Day 001/100:

Python3:

A programming language used to work with Machine Learning, Automation, and AI. You can also use it for Mobile Apps, Desktop programming and more. It's easy to learn and you don't need to know any programming language prior to understand. It's that simple. The code is short and clean while others are a bit complex. It's a high level language, cross - platform (Win, Mac and Linux), huge community and also a large ecosystem within the library of docs and all. It's been around for 20 years so that's even greater. To be honest, Python is the number one language that employers are looking for. Salary can be as much as $116,000 a year for becoming a developer of Python.

I wanted to start the python course. The training that I wanted to start the learning with is the awesome channel of MOSH. Here is the course link: https://www.youtube.com/watch?v=f79MRyMsjrQ. I like how his delivery is when giving content and advise and other courses. The notes below are what I am learning within the course. Enjoy!




Installation:

To install, you would want to visit : Python.org

Code Editor: 

You can use an IDE or an Editor. The most popular are VS CODE, Atom, Sublime. for IDE options: PyCharm. You can download either or which is comfortable. I chose VS Code of course.




Extensions for VS Code:

Python:

PyLint: uses by default.

What is Linting? When your code isn't valid of Python 3 standards, it will show you a indicator "red line" under the issue. Then it will allow you to hoover your mouse over it to see what the issue is. Good tool when you don't need to run the program and see the error before doing so.




Command Palette:  Shortkey: Shift + Ctrl + P. Different developers like different linters as well. Different linters include ones such as "flake8", "mypy", and etc. It's truly up your choice. I like "pylint" cause that's what MOSH chose. The differences of them is that the error messages are delivered different. They still do the same thing.

Problems: If you want to see the problems of your code while coding. Press the shortkeys : Shift + Ctrl + M. It's a window that will appear. Great tool to use while doing the code.




Formatting Python Code:

PEPs : Python Enhancement Proposals: The most popular is the PEP 8 which is the Style Guide. If you visit the site you can learn the way to style your code that will keep your code consistent with other developers. Very great tool for being on the right track with your coding. A good tool to install is autopep8. Then once installed. Change your settings for format on save. : File > Pref > settings >type: formatonsave. Check the box then exit.




Running Python Code

To run the python code without having to go in the terminal each time (which is tedious) another way to run is by using the extension : code runner. (pic should show of the words ".run" in comic font. When you install that extension, you then can code in python via the editor. Once coding and need to run, you simply press : Ctrl + Alt + N. Very easy way to run the py code.




Python Implementations

Python language: Set of rules for writing the code

Python Implementation : A program that understands how to use the rules

Cpython: A program written in the language C#. This is one the most popular implementations.They do the same thing, but just run different. Just like operating systems, browsers, or even languages. Choose whats best for you. I choose Cpython.

Others include:

Jython: written in Java
IronPython: Written in C#
PyPy: A subset of Python.







How is Python code executed.

C compiler: Allows you to convert C language to Machine Code.

Python > CPython > Python Bytecode > Python Virtual Machine > Machine Code. (This is how Cpython works)




Well you all. That's the notes for the first section. If you are interested in learning Python3 then don't wait. As you see, I am diving right on in and I advise you to do the same. I mean hey, the worst that could happen is that you just sit there wondering what it will feel like to be a great software engineer. I will post projects via my github and share links. I hope you enjoyed the notes. Until next time. Peace and Light!


www.DesignIsOrion.com