How to define python variables?

873    Asked by PavithraShah in Data Science , Asked on Nov 12, 2019
Answered by Pavithra Shah

 There are some important points that you keep in mind while declaring a variable in python. That is:

Variable should begin with the alphabet (a-z, A-Z) or underscore (_) but not with a special character or numeric digits.

Other characters can be a letter, numbers, underscore but not a special character.

Python is case sensitive programming language so variable name “a” and “A” are totally different.

Variable-length should be reasonable

Variable names should not be python reserved keywords because they are used for a different purpose.

Always choose meaningful names instead of putting random names because its easy to understand for other people.

In case there are many variables to declare then be consistent while declaring variable names.



Your Answer

Interviews

Parent Categories