निम्न 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 के दो प्रकार हैं:
-
/(Normal Division) -
//(Floor Division)
🔸 5 / 2 → Normal Division
-
यह हमेशा float result देता है
-
5 / 2 = 2.5 -
👉
type(5 / 2)→float
🔸 5 // 2 → Floor 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