In this class we discuss variable naming rules in python
0:00 Intro
0:33 Rule 1 start characters
1:06 rule 2 case sensitive
1:25 rule 3 only alphanumeric digits and underscore
1:42 python keywords
2:40 students confusion on variables
Welcome, wisdomers. In this video, we will discuss the essential rules you must follow when naming variables in Python. Mastering these naming conventions is key to ensuring your code maps correctly to memory. At the end of this lesson, we will share a special tip about a common point of confusion that many students encounter as they advance in their coding journey, so be sure to watch until the finish.
Rule 1:
A variable name must start with either an alphabetic character (a–z, A–Z) or an underscore (_). It is syntactically invalid for a variable name to begin with a numeric digit.
Valid names: username, password, subjects, _id, _math
Invalid names: 1user, 2user (Names cannot start with a number)
Rule 2:
Python treats variable names as case-sensitive. This means that names with different capitalization are interpreted as entirely different.
Example: user, User, and USER are three different variables.
Rule 3: Variable names can only contain alphanumeric characters and underscores. To be clear, 'alphanumeric' simply means a combination of alphabets and numbers.
Rule 4: Python 'keywords'—such as if, else, etc—cannot be used as variable names.
We will discuss these keywords in detail in future classes, so for now, just remember that they cannot be used as variable names.
A great programmer uses variable names that describe their purpose. If you are storing a student's ID, don't just call it x or id; call it student_id. By using meaningful names, you ensure that your code is clean, professional, and easy to maintain as your projects grow in complexity.
In our upcoming lessons, we will utilize variable names to point various data types in memory and, eventually, to point to specific blocks of code. During the initial phases of code analysis, many students encounter confusion regarding how these variables function. Therefore, maintaining a sharp focus during these foundational stages is essential for mastering the logic of programming languages.
visit our website www.wisdomers.in for quizzes and projects
On this page of the site you can watch the video online Variable Naming Rules in Python || Lesson 5 || Python for Beginners || with a duration of hours minute second in good quality, which was uploaded by the user Wisdomers - Placements & Programming 01 June 2026, share the link with friends and acquaintances, this video has already been watched 2 times on youtube and it was liked by 0 viewers. Enjoy your viewing!