Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Unit 1 — Identifiers & Reserved Words

Lesson 5 of 50 in the free Python Programming notes on Siksha Sarovar, written by Rohit Jangra.

Identifiers and Reserved Words

Identifiers

An identifier is the name given to variables, functions, classes, and modules.

Rules for naming identifiers:

  1. Can contain letters (a–z, A–Z), digits (0–9), and underscore (_).
  2. Must not start with a digit.
  3. Cannot be a Python reserved keyword.
  4. Case-sensitive (totalTotal).
  5. No spaces or special characters (@, $, %, etc.) allowed.
# Valid identifiers
name = "Riya"
_age = 20
student1 = "BCA"
total_marks = 450

# Invalid identifiers (would raise SyntaxError)
# 1student = "BCA"     -> starts with digit
# total-marks = 450    -> hyphen not allowed
# class = "python"     -> 'class' is a reserved keyword

Naming conventions (PEP 8):

  • Variables & functions: snake_case (total_marks)
  • Classes: PascalCase (StudentRecord)
  • Constants: UPPER_CASE (MAX_LIMIT)
  • Private members: leading underscore (_internal)

---

Reserved Words (Keywords)

Reserved words are predefined words with special meaning; they cannot be used as identifiers. Python 3 has 35 keywords:

False    None     True     and      as       assert   async
await    break    class    continue def      del      elif
else     except   finally  for      from     global   if
import   in       is       lambda   nonlocal not      or
pass     raise    return   try      while    with     yield
import keyword
print(keyword.kwlist)     # prints the full list of keywords
print(len(keyword.kwlist))
print(keyword.iskeyword("for"))    # True
print(keyword.iskeyword("value"))  # False