Learn Python
Lesson 1 - Introduction To Python
Lesson 3 - Control Flow
Lesson 4 - Functions
Lesson 5 - Basic Data Structures
Lesson 6 - Exception Handling
Lesson 7 - Modules And Packages
Lesson 8 - Basic String Operations
Lesson 9 - Object-Oriented Programming (OOP)
Remember the childhood math where we declared x = 10
and then found y = x + 2
? Here, x
is a variable containing the value 10 that we used to find the value of y
.
Similarly, variables in Python are used to store information, which can be numbers, text, lists, etc.
In Python, declaring variables is straightforward. Unlike some other programming languages, you don't need to specify data types like integer, float, or string explicitly.
num = 10 num_float = 10.55 print(num + num_float) # Outputs: 20.55
ch = 'a' print(ch) # Outputs: a
txt = "This is a text." print(txt) # Outputs: This is a text.
In Python, variables dynamically adapt to the type of data assigned to them, making it flexible and intuitive.