Question: 1. Try to understand Boolean variables or expressions and the data type bool by writing a program for the following. a. Define a variable (var_a)
1. Try to understand Boolean variables or expressions and the data type bool by writing a program for the following. a. Define a variable (var_a) and assign 0 to it. What do you think will be displayed when you type bool(var_a)? Think aboit your answer before you type the expression. b. Assign to var_a, the value 4. What do you think will be displayed when you type bool(var_a)? Think about your answer before you type the expresion. c. Assign 34 to var_a. What do you think will be displayed when you type boollvar_al? Think about your answer before you type the expression. d. Assign 3.75 to var_a. What do you think will be dinplyyed when you type bool(var_a)? Think about your answer before you type the expression. e. Based on (a).(c), what are the Boolean values for zero, and non-sero numbers? f. Define three variables {x,y,z} and assign the values 2,5 and 30 to them, respectively. What do you think the following Boolean expressions will evaluate to? Using the print function. i. (15+x+y)>(z5) ii. x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
