• Register
1 vote


I am new in python programming an I have been learning for this some days. As a newbee I am still learning and and I am cofused about some things. My question is “In an if/else statement, if the boolean expression is always false?”


10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

0 votes


A boolean or bool is a data type that has two possible values: it is either true, or false.
Very often when you write code, you want to perform different actions for different decisions. 
You can use conditional statements in your code to do this. 
Use if to specify a block of code to be executed, if a specified condition is true. Use else to specify a block of code to be executed.
A Boolean variable has only two possible values: true or false. It is common to use Booleans with control statements to determine the flow of a program. In this example, when the boolean value "x" is true, vertical black lines are drawn and when the boolean value "x" is false, horizontal gray lines are drawn

If you want to know more you can go to:


or visit:



11 6 4
34,950 points

Related questions

1 vote
1 answer 41 views
Problem: Let me put it as sim as I can. I have an if statement in my code and it returns a value. Since IF is a boolean statement it should return value whether it’s true or false. So, in my program when a method tests an argument and returns a true or ... as a parameter in a different method inside an IF statement. How should I do that? Any kind of help is appreciated by my side. Thanks.
asked Mar 17, 2020 Gavin 15.3k points
0 votes
1 answer 398 views
Problem: Hello programmers! I am learning to program, and I just got a little confused about boolean values and logical operators. I tried to run the following program: #include<iostream> using namespace std; int main() { bool check = false && true || true; ... program, I got the following output: Condition evaluated to true I am so confused about how this condition evaluates to true. Any help?
asked Dec 18, 2020 Code Learner 9.8k points
0 votes
1 answer 1 view
1 view
Problem: What's the difference between the dual and the complement of a boolean expression?
asked Apr 18 sumaiya simi 43.9k points
0 votes
1 answer 57 views
Problem : My function accepts the two arrays of integers and returns true if below conditions are met 1. Arrays have the same length and 2. Each m.element should be less than each n.element of the same index All my test cases are passing except when int[] m = {1, 2, 3} and int[] n = ... = (m[j] < n[j]); for (j = 0; j <= m.length - 1; j++) {} return (sameLength && digitDifference); }
asked Dec 3, 2019 alecxe 7.5k points
0 votes
1 answer 8 views
Problem: I'll make a submission for a response to my question. Please, I have searched the internet but have not found any useful material, and I am now having trouble continuing my studies.
asked Apr 1 rakib1 51.5k points
0 votes
1 answer 9 views
Problem: When I encountered this problem, I attempted to find a solution on the internet but was unable to find any useful details. If you read the above query and understand what the solution is, please cooperate with me- Thanks.
asked Apr 1 rakib1 51.5k points
0 votes
1 answer 8 views
Problem: anyone know this problem please help gray to binary code converter using k-map
asked Mar 11 Rohit kr 17.5k points
0 votes
1 answer 6 views
Problem: Please help me to solve it... complete the if-else statement to print 'lol means laughing out loud' if user_tweet contains 'lol'.
asked Mar 31 Ifra 36.4k points
0 votes
1 answer 2 views
Problem: I need help in resolving this problem: in greenfoot, what happens if the condition is false in an if-statement?
asked Apr 1 rakib1 51.5k points
0 votes
1 answer 10 views
Problem: I will request someone to answer my question Please, I have searched on the web but I got no useful information for this, now I am in difficulty continuing my learning
asked Mar 24 rubelkhan 20.4k points