🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्न Python कोड के आउटपुट में types क्या होंगी?

What will be the types printed by the following Python code?


print(type(5/2))
print(type(5//2))

A
float and float
B
int and int
C
float and int
D
int and float
Explanation

🔹 Explanation (Bilingual):

Python में division operators के दो प्रकार हैं:

  1. / (Normal Division)

  2. // (Floor Division)


🔸 5 / 2Normal Division

  • यह हमेशा float result देता है

  • 5 / 2 = 2.5

  • 👉 type(5 / 2)float


🔸 5 // 2Floor Division

  • यह integer result देता है (decimal को हटा देता है नीचे की ओर)

  • 5 // 2 = 2

  • 👉 type(5 // 2)int


🔹 Code:

print(type(5/2))   # Output: <class 'float'>
print(type(5//2))  # Output: <class 'int'>

Correct Answer: C) float and int

Latest Updates