Python Syntax - Codzify.com

1 min 41 sec read Basic


We will discuss the basic python syntax with an easy and interactive way in this tutorial. We use Python 3 as it supports many new features compared to Python 2. This first program will clear the concept of how to use print function. In Python 2, it was not compulsory to use parentheses while using print. But in Python 3, using parentheses is a must.

To print a string, just write and you can execute the program by clicking the Run button.

print("Welcome to the world of python programmers")

Indentations

Python Indentation is used to represent a block of code. Indentation includes (tabs and spaces) both.

For example, if you do not give space after if block in given example, it will throw an Indentation error. Try to execute this code for output.

if 12 > 4: print("Welcome to the world of python programmers")

Similarly, if you do give space after if block in given example, the output will be shown properly.

if 12 > 4: print("Welcome to the world of python programmers")

Comments

Python comments are written using # character followed by a statement.

#This is comment
print("Welcome to python programming")

One line or multiline comments

Python multiline comment or one line comment are written using DocStrings also called documentation strings. Docstrings are written using """ quotes.

"""This is one line,
multiline statement also"""

How was the tutorial? Nice. Right?



Deep Concept videos to crack the highly-piad interviews.

Chekout out our Youtube Channel to get detailed video content on important topics in interviews.



What is your Interview Score?

Test your skillset with the curated questions created by experts around the globe.

Book a free test slot. Now !.

It usually takes 30 mins for an online test and this test will be MCQ based. Get detailed analytics based on your test and recommedations with personalised roadmaps.

Book a test slot. Now!

Have questions about the trial coding class?

Chat with our experts to discuss

Connect on WhatsApp


Recommended tutorials

#online compiler for c     #python for programming    

#dfs and bfs algorithm     #programming with c language

#storageclass in C    #listcomprehension in python