What are the rules for identifier names?

 

Answer:

The rules for naming an identifier in Python are as follows: 

  • The name should begin with an uppercase or a lowercase alphabet or an underscore sign (_). This may be followed by any combination of characters a–z, A–Z, 0–9 or underscore (_). Thus, an identifier cannot start with a digit. 
  • It can be of any length
  • It should not be a keyword or reserved word
  • We cannot use special symbols like !, @, #, $, %, etc., in identifiers.
Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo