The web is filled with Python tutorials that prove to be amazing resources for anyone starting out with Python, and this is my tiny attempt at trying to contribute to that learning community as well that has been so helpful to me.
Without further ado, let’s get started. (Also, if you’re vaguely familiar with coding concepts, the first few tutorials might seem slow to you, and so feel frward to fast forward.)
Python is a great place to start if you’re only beginning to code. Here’s the reason why I think so. It s simple. It is to-the-point. It is easy to read. And thus, easy to write. You can accomplish a lot with just a few lines of code. There’s a reason Python is called the pseudocode language. It’s basically English.
For this series, we will be using Python 3, and if you’re following this, I’d recommend using Python 3 as well.
The very first task anyone ever accomplishes while learning a programming language is print out the famous words “Hello World”. Printing something out to the screen is the simplest program, and will help us dive straight into coding with Python.
If you’re from C/Java background, you must be used to writing a defined approach to printing something out.
Enter Python, and all you need to do is say it to print the following words – directly, and it will.
Point to remember: there is no semicolon (;) usage in Python, so remember to not include that at the end of each sentence. More about the use of semicolons in languages is described below.
Usually, the compiler – the software that converts your series of code into something that can be understood by the machine – needs to know when one instruction is over, so it can make the desired configurations for that instruction. Just like human languages use full-stop/ period (.) to know when a sentence ends to process it as one, computers most times take the help of semicolons to recognise that.
However, with Python, the sentence-end is determined by whitespaces. Blocks and new instructions are usually determined by whitespaces (like, tabs or newlines). However, one thing to note is that the use of semicolons does not raise an error. It can be used, technically. However, they don’t have to be used, but they aren’t restricted either.
So, let us bost up our Python IDLE or any other platform that you’re comfortable coding in, type the following and hit enter:
It should print “Great Scott” without the quotes. Here’s a screenshot attached.
And that is it. Printing a sentence is Python is one of the easiest things to do. In the next episode, we’ll see what variables are and how we use them at an elementary level.
In case youhave any questions, hit me up anywhere and I’ll try my best to answer them.