← Learn to Code — Python for Beginners
मॉड्यूल · Storing Information
Data types
Not all information is the same kind. Python needs to know if something is a whole number, a decimal, text, or a true/false value — this is called its data type.
The common ones you'll use constantly:
- int — whole numbers, like
26or-4 - float — decimal numbers, like
3.14 - str — text ("string"), like
"KIIT Polytechnic" - bool — just
TrueorFalse
roll = 26105012
cgpa = 8.4
branch = "CSE"
is_hosteler = True
You can check any variable's type with type():
print(type(roll))
print(type(branch))
Why this matters: you can add two numbers, but you can't add a number and text without Python complaining. Try the starter code below, then try changing roll to text in quotes and see what happens when you print(roll + 1) — reading error messages calmly is half of coding.