Questions tagged [boolean-expression]

A boolean expression is an expression in a programming language that produces a boolean value when evaluated, i.e. one of true or false.

In computer science, a Boolean expression is an expression in a programming language that produces a Boolean value when evaluated, i.e. one of true or false. A Boolean expression may be composed of a combination of the Boolean constants true or false, Boolean-typed variables, Boolean-valued operators, and Boolean-valued functions.

1049 questions
-2
votes
1 answer

How to implement the Boolean function = + ′′ + ′ with NAND and NOT gates

I have done the problem with AND , OR and NOT gates but cant figure out how to do with NAND and NOT gates. I dont know how to implement the NAND gate for this boolean expression.
-2
votes
1 answer

I have trouble with changing the process of that code in Java

I have trouble with changing my code. I want to do that with a boolean and I have no clue how to do that. It is just confusing me. This is my task: Tyrepressure-test It is to check whether the pressure of all tires is between 35 and 45. If a tire is…
-2
votes
1 answer

Why is year 1900 not returning False?

def is_leap_year(year): if (year%4==0 & (year%100!=0)) | (year%4==0 & year%100==0 & year%400==0): return True else: return False print(is_leap_year(1900)) I would like for the argument (1900) to yield a False, since both…
Labbsserts
  • 99
  • 2
-2
votes
1 answer

Can Ansible's win_powershell thoroughly process a boolean

win_powershell seems to choke when I attempt to pass a Boolean variable through it to register a tested discrete state on a remote guest/target (for later consumption). For numerous attempts to provide compliant statements, I get errors such as…
GlennRA
  • 57
  • 3
-2
votes
1 answer

What the meaning of AB+C?

I want to know that what is the truth table and logic circuit gate for following Boolean expression. (A+B).(AB+C) I have a doubt in what the meaning of AB+C please, I want some help to get through this. It's important to my ICT examination.
-2
votes
1 answer

Evaluating boolean expressions in Java dynamically

I made use of JEP earlier and then realised that it wont fit my case. On a call to the database/backend, I get a json response, which has a structure as below: "key": { "!A & B" } And there will be values for A and B like true or false. I used…
RCB
  • 479
  • 1
  • 9
-2
votes
1 answer

Boolean algebra how to complete missing expressions

For example, AB + AB' = A and ABC + ABC' = AB. When the user enters AB, how can I find the missing letter and give it the form it was before it was simplified? In fact, what we need to do is multiply the missing letter and the missing(not) letter…
-2
votes
1 answer

how this Ternary Operator work with this statemnt?

i just generate this methode to find max val in some matrix and somehowe i was able to change int val insdie Ternary Operator (java 8) int max=0, indexToReturn=0; int size= arr[0].length; for (int i=1 ; i < size ; i++) { …
-2
votes
3 answers

Why is `!!(a||!a)` always true?

I'm a Java rookie and in School we got some homework. I shall explain boolean terms but I don't understand one of them. The question is Why is this expression always true? !!(a||!a) I understand the part in the brackets but what do the two…
mhcx
  • 19
  • 2
-2
votes
4 answers

How to use parentheses correctly?

Why does it work differently? p='/content/Images_of_Waste/img/PET968.txt' p[-3:]!='txt' and p[-3:]!='jpg' False p[-3:]!=('txt' and 'jpg') True How can I use parentheses correctly?
Oleg
  • 97
  • 5
-2
votes
2 answers

How to use the string bool expression to filter a list

I have a bool expression age_str = "age<=3" and a age list age_list = [1,2,3,4],how to use the age_stri to filter the age_list? the expected output is [1,2,3]
Philo
  • 3
  • 2
-2
votes
2 answers

A, B and C are three boolean values. Write an expression in terms of only !(not) and &&(and) which always gives the same value as A||B||C

Chanced upon this beautiful problem. Since I am new to Boolean expressions, it is looking quite difficult. I guess parentheses can be used. If one of A, B, C is true, A||B||C must be true. Using AND and NOT, it can be done but, how do we know which…
-2
votes
1 answer

Is below equation with boolean operator correct?

is this correct? (A && X) || (B && Y) || (X && Y) = (A || X) && (B || Y)
Bibek Dey
  • 3
  • 1
-2
votes
3 answers

Variable reassignment with chained booleans or ternary operator

To clarify: This is purely for experimental purposes, to learn the quirks, odds and ends of a new (to me) language. I would of course write it readable if I ever were to share this code with anyone else. :-) I have a function someFunction(x), and…
-2
votes
3 answers

Why is python if condition not working for values of "False"?

In the following code, is_number is False for the value "foo", but this still prints is a number for that string. Why? And how do I fix it? def string_is_number(a_string): pattern = re.compile(r'[0-9]+') if pattern.search(a_string): …
code_to_joy
  • 569
  • 1
  • 9
  • 27