Python

Identifiers and Variables in Python

Identifiers in python

  • A name in python program is called identifier.
  • It can be a class name or function name or variable name

Rules to define identifier

  • Identifiers include alphabets symbols(either lower case or upper case)
  • Identifiers include  digits(0 to 9)
  • Identifiers include underscore (_)symbol.
  • Identifiers should be case sensitive.

Don’t s while defining an identifier

  • We cannot use keywords as identifiers
  • Identifiers should not start with digit.

Special case of using underscore

  • If the identifier starts with underscore (_)symbol then it is private.

Variables in python

What is a variable?

•   A variable refers to  memory location.

•   It is used to store the value .

•   Variable is used to give data to the computer for processing .

Specifying a variable

•   In python we don’t need to specify the type of variable because python is a dynamically typed to get variable type.

•  Variable names include  letters and digits but they have to begin with a letter or an underscore.

•   It is suggested to use  lowercase letters for variable name

Lakshmi Durga

Share
Published by
Lakshmi Durga

Recent Posts

What are Template Tags in WordPress? How to Use Template Tags

In wordpress if you are developing new or custom wordpress theme or wordpress plugin then…

2 months ago

Google Search Indexing Issues Started on 31st January to February 2024

If you are experiencing indexing issues of your website then you are not alone and…

3 months ago

Create QR Code for Pages & Post using Plugin in WordPress

On your wordpress website if you want to generate qr code for pages and posts…

3 months ago

Add Google Search Console HTML File Upload on WordPress

If you are trying to verify your WordPress website with google search console with html…

3 months ago

How Do I Add Google Search Console Verification HTML Tag in WordPress?

If you are on wordpress website and wondering how to keep search console html verification…

4 months ago

Why WordPress Too Many Redirects After URL Change

If you are getting too many redirects error on your WordPress website after changing url…

4 months ago