Basic Syntax Python Program Line By Line

Basic Syntax Python Program Line By Line
Basic Syntax Python Program Line By Line

    What is the syntax of the Python program?

    Syntax: Python code is very simple to write and execute any Python Program.
    Python Program can be executed directly in the command line. python programming can be used very simply.
    python programming program structure is a very simple and useful command base program executed like a calculator.

    Python syntax

    print("Hello Python Welcome To icoderweb")


    *****OUTPUT*****


    Hello Python Welcome To icoderweb


    Most Others Languages Syntax

    👉C Language Syntax 


    Indentation in Python

    Python language programming is different from any other languages like C, C++, Java, and more languages use curly braces to indicate blocks of code for class and function definitions and flow charts controls.
    But Python uses indentation to indicate a block of code. We can use at least one space for indentation. python language is not allowed space.

    a=5

    b=10

    if a>b:

        print("a is grater than b")

    else:

        print("b is grater than a")

    *****OUTPUT*****

    b is greater than a


    Python Code will raise an error if you skip indentation

    a=50

    b=100


    if a>b:


    #this line will raise an error


    #because no indentation


    print("a is greater than b")


    else:


        print("b is grater than a")


    *****OUTPUT*****


    IndentationError: expected an indented block this program can not be executed.


    You can use the number of spaces for indentation but spaces must be the same in the same block of code.

    a=50
    b=40
    if a>b:
             print("a is greater than b")
             
    else:
             print("b is greater than a")

    *****OUTPUT*****
    a is greater than b


    Post a Comment

    0 Comments
    * Please Don't Spam Here. All the Comments are Reviewed by Admin.