How to distinguish between a variable and an identifier?

0 votes
I am new to Python. Can someone explain to me the difference between an identifier and a variable?
Jul 31, 2019 in Python by Neel
• 3,010 points
518 views

1 answer to this question.

0 votes

Key Differences between Identifier and Variable

  1. Both an identifier and a variable are the names allotted by users to a particular entity in a program. The identifier is only used to identify an entity uniquely in a program at the time of execution whereas, a variable is a name given to a memory location, that is used to hold a value.
  2. Variable is only a kind of identifier, other kinds of identifiers are function names, class names, structure names, etc. So it can be said that all variables are identifiers whereas, vice versa is not true.

As identifier and variable names are user-defined names, it should be taken care that no two identifiers or no two variable names in a program should be the same. It will create a problem of ambiguity in a program.

answered Jul 31, 2019 by Arvind
• 2,980 points

Related Questions In Python

0 votes
1 answer

How to have values from a List1 into Columns Names and List 2 Values as Index for an Empty DataFrame

Try like this, it will give you ...READ MORE

answered Jul 10, 2019 in Python by Cherukuri
• 32,460 points
162 views
0 votes
1 answer

How to write a regular expression to check whether an input is an identifier or not?

As per the documentation, an identifer can ...READ MORE

answered Aug 8, 2019 in Python by Neel
• 3,010 points
502 views
+1 vote
1 answer

How to append an integer to a string?

You can not directly concatenate two different ...READ MORE

answered Aug 16, 2018 in Python by Omkar
• 69,040 points
133 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 929 views
0 votes
0 answers
0 votes
1 answer

How to check whether something is a variable or a function in Python?

Suppose you have a variable defined in ...READ MORE

answered Jul 30, 2019 in Python by Arvind
• 2,980 points
98 views
0 votes
1 answer

Is it possible to read a text file into a string variable and then scrap the newlines?

This can be done easily in Python. ...READ MORE

answered Aug 7, 2019 in Python by Arvind
• 2,980 points
59 views