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