Python Learning Series · @onlysamarrr · Day 2 / 30
Day 2 covers the four basic data types: int for whole numbers, float for decimals, str for text, and bool for True or False. The type() function tells you which type a value has.
Phase: Beginner · Reels: 6/450 – 10/450
Day 2 covers the four basic data types: int for whole numbers, float for decimals, str for text, and bool for True or False. The type() function tells you which type a value has.
age = 21
price = 99.5
name = "Arhan"
is_pro = False
print(age, type(age))
print(price, type(price))
print(name, type(name))
print(is_pro, type(is_pro))
print("5" + "5")
print(5 + 5)
21 <class 'int'> 99.5 <class 'float'> Arhan <class 'str'> False <class 'bool'> 55 10
Data types are everywhere: prices are floats, ages are ints, names are strings, and login status is a bool.
Select (tick) an option, then tap Check answer to see instantly whether your answer is right or wrong, with an explanation. You can change your answer and check again.
Q1. What is the type of 3.5?
Q2. What happens with "5" + 5 in Python?
Q3. Which value is a bool?
| 6/450 | Concept | int, float, str, bool kya hain |
| 7/450 | Live demo | type() se data type check |
| 8/450 | Common mistake | "5" aur 5 mein farak |
| 9/450 | Quiz | Quiz: guess the type |
| 10/450 | Interview / real life | Real life: data types kahan use hote |