Day 2: Variables and Data Types
Understanding the basics of Python step by step

Today I learned about:
Variables.
Data Types.
Types Of Operator.
Type Function and Type Casting.
I/P Function.
Variables
Variables are used to store data in Python.
Instead of writing values again and again, we can assign them to a variable name and reuse them whenever we want.
age = 30
name = "Alice"
Here, age and name are variables, and they store values.
It felt similar to labelling things so they’re easier to refer to later.
Data Types
Every value in Python has a data type.
Some common ones I learned today are:
int → whole numbers
float → decimal numbers
str → text
bool → True or False
age = 30
price = 10.5
name = "Alice"
is_active = True
Understanding data types helped me realize why Python behaves differently with numbers and strings.
Types of Operator
Operators are used to perform operations on values and variables.
Some types of operators I learned about:
Arithmetic operators (
+,-,*,/)Assignment operator (
=)Comparison operators (
==,>,<)Logical operators (
and,or,not)
a = 10
b = 5
print(a + b)
print(a > b)
This part made things feel more like actual logic and decision-making.
type() Function and Type Casting
Python provides a built-in function called type() that tells us the data type of a value or variable.
x = 10
print(type(x))
It prints that x is an integer.
I also learned about type casting, which means converting one data type into another.
age = "30"
age = int(age)
This is useful when working with user input, which is usually treated as a string.
Input Function
The input() function allows users to enter data.
name = input("Enter your name: ")
print(name)
I learned that whatever we get from input() is always a string, even if the user types a number. That’s where type casting becomes important.
Takeaway:
Variables help store and reuse data
Data types decide how Python treats values
Operators help perform actions
type()helps understand what’s happeninginput()makes programs interactive



