Identifier-in-Python .

In this session i have discussed identifier in Python .


Identifier refers the name of variable , function , class etc . It is always user defined .


Rules for Writing Identifier

1-First letter of an identifier must be alphabet (underscore is also allowed)

2-Identifier can only contain letters, digits and underscores

3-White space is not allowed

4-Keywords can not be used as identifier .

5-Upper and lower case both allowed . The identifier written in lowercase differ from upper case .


    a=10            #allowed in python
    a_1=11          #allowed in python
    _a=12           #allowed in python
    emp_name="Amit" #allowed in python
    emp name="Amit" # White space not allowed in python
    if=10           # if is a keyword in python so you can declared if as a variable
    x=10            # x is small letter 
    X=12            # X is capital letter both are differ
    print(x)        # 10
    print(X)        # 12

    

Welcome to AndroidATPoint.

back image                     next image