Introduction to Python
Needs no introduction…🤣
Here I might not explain much but we will code more as this will prepare us for interviews. This is for people who know python a little bit or are willing to Re-Learn like me.
Let’s Begin!
Small Introduction
Python an interpreted programming language mostly used for tasks like machine learning, data science, scientific computing and backend web development.
Question: Interpreted Language?
Python is an interpreted language, meaning its code is executed line by line by an interpreter. If you call a function before defining it, Python will throw an error immediately at that line.
Java, on the other hand, is a compiled language. The compiler scans the entire code first, checks for errors, and then generates bytecode to run. That’s why in Java; errors are caught before execution begins.
Our Classic — Hello, World!
print("Hello, World!")As Hello, World! is string, it should be written in between “ ” or ‘ ’. If not then we will see an error.
First Way
print("I am \"Awesome\" ")
#or
print('I am \'Awesome\' ')It will print as follows
Get Gehna Ahuja’s stories in your inbox
Join Medium for free to get updates from this writer.
I am “Awesome”
I am ‘Awesome’
Second Way
print('I am "Awesome" ')
#or
print("I am 'Awesome' ")It will print the same result as above; the only difference here is that we use the opposite punctuation, so the interpreter can correctly identify the ending point.
Execution Order Matters
As mentioned earlier python executes code line by line. So, if you type
print(1)
print(2)
print(4)#Then it will print1
2
4
Let’s say we have to print something as quote, then there are two ways to do that.
Comments
For commenting you use#. Shortcut keys to quickly comment out the code or sentences is to select the lines you want to comment out and press Ctrl + / (Windows / Linux) or Cmd + / (Mac). This will automatically add the # character to the beginning of each line.
That’s all for the introduction, will post the link for Variables soon. So, stay tuned!









