what will bethe output of the following code
print(bool(0)),bool(3.14159),bool(-3),bool (1.0+1j)
a)false true false true
b)true true false true
please answer correctly i will mark brainliest
Answers
Answered by
4
Answer:
answer is B true true false true
Answered by
1
Answer:
The output of the given code will be false true true true.
Boolean:
- A boolean is a built-in data type.
- It is used to represent the true value of an expression.
- A boolean expression has only two values; either 1 or 0.
- 1 denotes a true value and 0 denotes a false value.
- For example 1>2 will give the output as false or 0 whereas 5>3 will give the output as true or 1.
- If instead of an expression, a single number is input, then the output is false only if the number is 0. In all other cases, the output is true.
Explanation:
- The given statement has four boolean expressions.
- The expression bool(0) will give the output as false since the input value is zero.
- The expression bool(3.14159) will give the output as true as the input is non-zero.
- The expression bool(-3) will give the output as true as the input is non-zero.
- The expression bool(1.0+1j) will give the output as true as the input is non-zero.
- All these four outputs are then printed.
Therefore, the output of the code is false true true true.
#SPJ3
Similar questions
Math,
4 months ago
Hindi,
4 months ago
Business Studies,
9 months ago
Chemistry,
9 months ago
Geography,
1 year ago