Question
1.
2.
3.
4.
Answer (Detailed Solution Below)
Option 4 : 10 / 10
Advertisement
Detailed Solution
सही उत्तर 10 / 10 है।
Key Points
Helpful?
Question:
What is the output of the following Python code? `print((True + False) * 10)` / निम्नलिखित Python कोड का आउटपुट क्या होगा? `print((True + False) * 10)`
1.
True / True
2.
1 / 1
3.
Error — cannot do arithmetic on booleans / त्रुटि — boolean पर अंकगणित नहीं हो सकता
4.
10 / 10
Correct Answer: 10 / 10
In Python, `bool` is a subclass of `int` with True == 1 and False == 0, so (1 + 0) * 10 = 10. The trap is assuming booleans reject arithmetic. / Python में `bool`, `int` का subclass है जहाँ True == 1 और False == 0, अतः (1 + 0) * 10 = 10। जाल यह मानना है कि boolean अंकगणित को अस्वीकार करते हैं।
Downloaded from PrepSnap (prepsnap.in)