position: fixed; top: auto !important; margin-left: 112px;

Python Syntax

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

Previous Next Article







codzify.com


Largest collection of up-to-date tutorials to learn programming languages. We are focused on easy learning. Massive collection of interview questions one may need for preparation.

Social Profile


Linkedin
Twitter
Facebook

Copyright 2018. All rights reserved.