In this article, you will learn some basic concept of Python Syntax format.
Python Syntax – Before moving ahead, let’s know a little bit about Python first program – Hello World
Introduction – Python is open-source and free programming language. It is easy to use and learn as compared to other languages like C ++, Java, C# and JavaScript. It is highly recommended and allows itself to get integrated with other languages like C ++, C#, etc., One of the most important key factors of Python is it is Object-Oriented Language and had been used by many giant companies for so many purposes such as handling file data, web app, Desktop application, Machine learning and so on.
Syntax
Execute Python Syntax – Syntax refers to the structure of the language. The Syntax of Python language sets the rule which defines how a Python program will be written. In other words, it sets a format to write and handle codes. Python syntax can be executed by writing or simply created a code directly in the Command Line:
>>> print("Hello, World!") Hello, World!

Or by creating a python file on the text editor, using the (.py) file extension, and running it in the Command Line:

Indentation
Python Indentation – In Python, indentation plays an important role. If we do not be careful regarding indentation, then Python will give us an error. Indentation refers to the whitespaces at the beginning of a line. Generally, for give an indentation to a block of code, either you can press Tab keyword once or press Space keyword four times for per indentation (1 Indentation = Four Space). Python uses indentation to indicate a block of code.
Example –
If 10 > 9: print("10 is greater than 9")

Let’s see one more time this same example but now it has Syntax Error.
If 9 > 10: print("9 is less than 10")

Note: In above example, word print is underlined with red line because it is showing an Indentation Error.
Note: Use same number of indentations throughout block of code, otherwise Python will give us an error.
If you find anything incorrect in above discussed topic and have any further question, please comment down below.
Follow Us