January 7 - Logical Operators and Conditional Statements.docx
University of North Georgia
• A proposition is a statement of fact that can be determined true or false.
• A propositional variable is a letter assigned to represent a proposition. Most commonly p
• p: it is raininq: 3+5=8 negate these with the ! or ~ symbol as in !p or ~p (read: not p)
q: There are at least 12 students in the class.
!q: There are greater than 12 students in the class.
Negating a proposition involves using proper English grammar to state the opposite of
the proposition, or what would make the original proposition false.
• Truth table for the not (!) operator:
The not symbol is a unary operator, meaning it operates on only one number.
• p: It is raining. q: 3+5=8
^ is the AND symbol
p^q means p AND q. This is true only when both p and q are true.
Truth table for ^ (AND)
p q P^q
T T T
T F F
F T F F F F
• v is the OR symbol
p v q is true when one or the other or both is true
Truth table for v (OR)
p q p v q
T T T
T F T
F T T
F F F
• exclusive or (XOR)
Exclusively A or B, but not both