LearnFromHome > coding > python
Python is a popular, high-level programming language known for its readability and versatility.
Learn how Python handles data and how to store it using variables.
A variable is like a container that holds information you can use later. In Python, you don't need to declare a variable's type—just assign a value using the =
operator.
name = "Alice"
age = 25
is_student = True
"Hello"
5
or -2
3.14
You can check the type of any variable using the type()
function:
print(type(name)) # Output: <class 'str'>
print(type(age)) # Output: <class 'int'>
Python uses dynamic typing, which means you can change a variable's value and even its type without errors:
data = 42
print(type(data)) # int
data = "Now I'm a string!"
print(type(data)) # str