Search This Blog

Wednesday, 15 December 2021

Identifiers in Python and its usage

 

Python Identifiers

create a website for free

An identifier is a name given to entities like class, functions, variables, etc. It helps to differentiate one entity from another.

Rules for writing identifiers

  • Identifiers can be a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore _. Names like myClass, var_1 and print_this_to_screen, all are valid example. 
  • An identifier cannot start with a digit. 1variable is invalid, but variable1 is perfectly fine. 
  • Keywords cannot be used as identifiers
>>> global = 1
  File "< interactive input >", line 1
    global = 1
             ^
SyntaxError: invalid syntax
  • We cannot use special symbols like !, @, #, $, % etc. in our identifier.
>>> a@ = 0
  File "< interactive input >", line 1
    a@ = 0
         ^
SyntaxError: invalid syntax
  • Identifier can be of any length.

No comments:

Post a Comment

how to implement YOLOv3 using Python and TensorFlow

Object Detection with YOLOv3 Introduction YOLOv3 (You Only Look Once version 3) is a real-time object detection algorithm that can detect ob...