Variables in Python are used to store data values. A variable is created the moment you assign a value to it. Python is dynamically typed, which means you don’t need to declare the type of a variable explicitly.

Syntax for Variable Assignment

x = 10          # Assigning an integer value to x
y = "Good Morning"  # Assigning a string value to y

Variable Naming Rules

  • Variable names can contain letters (a–z, A–Z), numbers (0–9), and underscores (_)

  • Variable names must start with a letter or an underscore

  • Variable names are case-sensitive (Name and name are different)

Example

age = 25
name = "John"
is_student = True
Age=30

Note:
age and Age are treated as two different variables in Python because variable names are case-sensitive.

What’s Next?

This is Day 2 of Python Basics.

In the next post, we’ll cover operators, user input, and simple Python programs.
Make sure to bookmark this page and check back for the next lesson.

If this post helped you, share it with a friend who is starting to learn Python.
Learning is better when we grow together.

Thank you for reading!
Try the examples on your system and drop your questions or thoughts in the comments below.

Comments

Popular posts from this blog

Introduction to python for beginners