Courses Enquiry

Python Syntax - Codzify.com

1 min 41 sec read


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 the 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"""

Unlock learning opportunities with our expert-led coding courses.
Real-time doubt solving in a live online coding class is also available in the course
that will help you to stay connected with an experts while learning.

Browse Online Coding Classes Videos