Python | Indenting Code By. Shivansh Sir

 PYTHON PROGRAMMING

PYTHON | INDENTING CODE

Python में Code indentation को काफी महत्व दिया गया है | 

Python में Code Indentation का इस्तेमाल functions, classes, Loops और control statements के लिए किया जाता है |

Python में curly braces({}) की जगह code indentation का इस्तेमाल किया जाता है | 

Python में जब code indentation में colon(:) या delimiter दिया जाता है तब automatically अगले line पर interpreter द्वारा tab( ) दिया जाता है |

PYTHON | INDENTING CODE | FUNCTION

Source Code

def func():

    a = 5

    print(a)

func()

Output

5

PYTHON | INDENTING CODE | FOR LOOP

Source Code

list = [1, 5, 8, 9]

for i in list:

    print(i)

Output

1

5

8

9

PYTHON | INDENTING CODE | CLASS

Source Code

class myClass:

    def func():

        a = 5

        print(a)

myClass.func()

Output :

5


For Any Doubt Clear on Telegram Discussion Group

Join Us On Social Media

For Any Query WhatsApp Now

Comments

Popular posts from this blog

Python | All in One Program By. Shivansh Sir

Python | Data Types | Number & it's Conversion By. Shivansh Sir

Python | Loop | For Loop By. Shivansh Sir