Online Classes

Results can only be achieved if you have the focused direction and crystal clear knowledge. To achieve this, you need a mentor. We will help you out by connecting with an expert mentor in the field.

Learn More

Article

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

Try to execute what you have learnt

Easy to use online data structure compiler where you can execute the programs in your favourite programming language.
(C, C++, Python)

Open Compiler

HTML, CSS and Javascript Real time Web Editor

Execute your HTML, CSS and javascript code in real time with the web editor
(HTML, CSS, Bootstrap, Javascript)

Open Web Editor