January 20, 2019 AM

The beginning of a new language : Python

So today I decided to try my hands on learning a new programming language (at least for me) that is python. Working over 10 years with the LAMP stack made me think that the world of programming is changing and there is a need, or I should rather say a desperate need for me to learn something new, something which is more powerful, fast and scalable than the technologies that I knew about.

Learning for me has been a crucial part of my life be it in professional or personal terms. As I always say that I am thankful that I am into a professional where to remain relevant I need to learn new technologies and tools on a regular basis.

So I started with looking for a genuine source where I could gain knowledge about the Python Language, what could have been better than Microsoft. I have already attained few certifications from Microsoft in the past years.

Microsoft Virtual academy has been my pal from a long time and has helped me to understand the basic of everything I wanted to learn.

So python seemed to be a very forgiving language, and the most awesome part is that there is no need to add a semi-colon at the end of every line of code. (Seriously, I am saying that without being under any influence). It has made lives of programmers so much easier and has solved the most common problem of forgetting semi-colons in any piece of code. Other than that, the syntax is quite simple.

Here is a small code in python to display hello world.

Print(“Hello World”)

Output:
Hello World

Q: How do we comment in python?

A: Using a pound symbol (#)

# This is a comment

Q: How do we display a single quote symbol?

A: Well this can be quite tricky, as the apostrophe symbol itself tells the interpreter that anything inside these quotes are to be considered as a string. So if you have to display: Macy’s pen was with me, you will have to write the code like this:

Print("Macy\’s pen was with me")

Output:
Macy’s pen was with me

Q: What if we need to display the backslash itself which using \n for next line?

A: For achieving something like that you will need to use double backslash like this:

Print(“Macy\’s pen was with me \\n she left it purposely.”)

Output:

Macy’s pen was with me
She left it purposely.

Another great thing that I found was, just like we use <pre> tag in html and the html code gets displayed exactly the same way it’s been typed. In python triple single/double quotation marks are used to achieve the same functionality. Here is an example.

Print('''This is
a beautiful world
''')

Output: This is
A beautiful world

Have not seen this triple comment thingy with any other programming language I know of.

 

,