Python Chapter 2

Chapter 2 Python Data Types

Yahan aap samjhoge ke Python kis cheez ko number samajhta hai, kis cheez ko text samajhta hai, aur kis cheez ko true ya false samajhta hai.

Python is cheez ko kya samajhta hai?

Koi value likho. Hum batayenge ke Python usay number, text ya kuch aur samajhta hai.

Python ka jawab

str

Text string hota hai.

Quick Quiz

5 sawalon se apni understanding check karo.

Python mein 5.2 kis type ka example hai?

"hello" kis type ka example hai?

True Python mein kis type ka example hai?

int("12") ka result kya banay ga?

float("Ali") ka kya hoga?

Aik cheez ko doosri cheez me badlo

Yahan dekh sakte ho ke text ko number ya number ko text kaise banaya jata hai.

Naya result

12

int() decimal ka integer part rakhta hai.

Core Data Types

Integer

int

int

Integer woh number hota hai jisme decimal point nahi hota.

Class ke total students 45 hon to yeh int hoga.

students = 45
print(type(students))

Float

float

float

Float decimal wala number hota hai.

BMI ya height jaisi values 5.7 ya 1.75 float hoti hain.

height = 1.75
print(type(height))

String

str

str

String text hota hai jo quotes ke andar likha jata hai.

Student ka naam "Ali" string hoga.

name = "Ali"
print(type(name))

Boolean

bool

bool

Boolean sirf do values rakhta hai: True ya False.

Attendance complete hai ya nahi, yeh bool se show hota hai.

is_pass = True
print(type(is_pass))

Other Data Types (Coming Next)

List aur tuple ka quick preview yahan hai. Full detail Chapter 3 mein aayegi.

List

List multiple values ko aik jagah rakhti hai aur order maintain karti hai.

Tuple

Tuple bhi multiple values rakhta hai, lekin isay fixed group samjho.

More Python Topics

More Python Topics

Data types ke baad baqi important Python topics bhi yahan se khol sakte hain.