CHAPTER 06   •   PYTHON

Python Variable Names

Learn the rules for naming Python variables.

01 What is this?

Learn the rules for naming Python variables.

02 Syntax

Python Syntax
student_name = 'AIFA'

03 Example

Python Example
first_name = 'AIFA'
student_age = 20
print(first_name)

04 Important Points

Variable names can contain letters, numbers and underscores but cannot start with a number.

05 Common Mistakes

Do not use spaces or reserved Python keywords as variable names.

06 Real World Use

Good naming makes large programs easier to understand.

07 Practice This Topic

Now try the example yourself in the AIFA Python Editor.

  • Read the example carefully.
  • Change the values.
  • Run the code.
  • Observe the output.
  • Try creating your own example.
Try It Yourself →