♦ Python Syntax
♣ About Python Syntax
Syntax means a basic way of arrangement(skeleton) of code which is essential for the code to parse and run.♣ Example1: Syntax in Python
Let us take a simple if condition and explain the basic syntax. Example
Input:
Output:
Indentation is very important in Python, without Indentation the program will not be compiled
Here there is a Indentation before print statement(a "single tab" here)
Here there is a Indentation before print statement(a "single tab" here)
♣ Example2: Wrong Syntax in Python
Let us take a look at Indentation error which can occur if there is not a "tab" before the print statement. Example
Input:
Output:
Program halted due to error.