Boolean Logic, Logical Operators, & Conditional Statements Flashcards

1
Q

What is Boolean Logic?

A

Boolean Logic involves two values: Yes or no, true or false, one or zero. It’s what helps a computer decide.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Who created the Boolean Logic?

A

George Boole.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Are computers able to make decisions with vague statements?

A

No. Just like me, computers have black and white reasoning. Therefore, if a statement is vague, it’s unable to make a decision since it works best when statements are made clear.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are propositions?

A

Propositions are statements in Boolean Logic that are either true or false.

They are also Python expressions, but with logical operators.

For example, “Gojo is the strongest” is a proposition since the answer will be true. “Gojo is my lover” is also a proposition since the answer will be false (cries).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the three properties of propositions?

A
  1. There should only be one value.
  2. It should be clear and not vague.
  3. It’s possible to combine propositions in order to make complex ones.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are logical operators?

A

These are words that connect multiple propositions into one Boolean expression.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the three types of logical operators?

A
  1. “And”
  2. “Or”
  3. “Not”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How does the logical operator “And” work?

A

It claims that all propositions together should be true for the entire Boolean expression to result as true. To put it simply, both propositions should be both true, so the result will be true. If one proposition is false, then the result is false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does the logical operator “Or” work?

A

It claims that at least one proposition should be true for it to result as true. If both are false, then the result is false. For example, “If Gojo is the strongest, and he did, indeed, win, then he is a true sigma.” The first proposition is true, but the second isn’t. However, since one of them is true, then the conclusion is true. He is, for real, a true sigma.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does the logical operator “Not” work?

A

If a proposition is “not” true or false, then it is false or true, respectively. For example, “Geto is not a eugenicist.” The statement is false. But since there is a “not,” that would mean the result is true (wait, what? But that’s how the concept works, so don’t give too much attention to what the example says).

“Not” requires only one logical statement, unlike the earlier two logical operators.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Are there other types of operators?

A

Yes, it’s not just the three types. There are two other types of operators, which are called “relational” and “equality.”

Under relational, we have the greater than, less than, greater than or equal to, and lesser than or equal to.

Under equality, we have equal to (==) and not equal to (!=).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the precedence of the operator types?

A
  1. Relational
  2. Equality
  3. Not
  4. And
  5. Or
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are conditional statements?

A

Conditional statements are what help our programs make a decision through the use of conditions, also known as logical statements or propositions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the differences between propositions and conditional statements?

A

Propositions are statements that are either true or false. Conditional statements, however, are a combination of propositions where a computer decides if one or both of them are either true or false and concludes an answer from it.

Basically, conditional statements are what programs use to decide if the conditions are true or false, lol.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the different types of conditional statements?

A
  1. If
  2. Elif
  3. Else
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How is “elif” used?

A

“Elif” is used if there are multiple conditions.

17
Q

What is a nested condition?

A

These are conditions that are inside a condition. For example,

“Is Gojo the strongest?” Yes or no. After, another condition comes in. “Is he your love?” Yes or no, and so on.