Python-Programming-Day2
Lets learn Identifiers, Keywords & Variables
Identifier in python:
- An identifier is a name given to entities like class, functions, variables, etc. It helps to differentiate one entity from another.
- Variables are the example of identifiers.
- An Identifier is used to identify the literals used in the program.
The rules to name an identifier are given below:
- 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 a valid name.
- Keywords cannot be used as identifiers.
Ex. global = 1 , global is keyword so we can’t use as identifiers.
Keywords in python:
- Keywords are the reserved words in Python.
- We cannot use a keyword as a variable name, function name or any other identifier.
- They are used to define the syntax and structure of the Python language.
- In Python, keywords are case sensitive.
- There are 33 keywords in Python 3.7. This number can vary slightly over the course of time.
All the keywords except True, False and None are in lowercase and they must be written as they are.
Get PratikMurlidharYadav’s stories in your inbox
Join Medium for free to get updates from this writer.
The list of all the keywords is given below.
Things to Remember:
- Python is a case-sensitive language. This means, Variable and variable are not the same.
- Always give the identifiers a name that makes sense. While “c = 10” is a valid name, writing “count = 10” would make more sense, and it would be easier to figure out what it represents when you look at your code after a long gap.
- Multiple words can be separated using an underscore, like “this_is_a_long_variable”.
Variables in Python:
- Variable is a name that is used to refer to memory location.
- Python variable is also known as an identifier and used to hold value.
- Variable names can be a group of both the letters and digits, but they have to begin with a letter or an underscore.
- It is recommended to use lowercase letters for the variable name. Rahul and rahul both are two different variables.
- In Python, variables are a symbolic name that is a reference or pointer to an object. The variables are used to denote objects by that name.
How variable are temporary store the value in memory.
Some Examples of variables :
name = "Devansh"
age = 20
marks = 80.50
print(name)
print(age)
print(marks)



