What is a Boolean

  • The defention of a Boolean is a denoting a system of algebraic notation used to represent logical propositions, especially in computing and electronics.

  • A boolean expresions are either true or false.

  • Testing if two numbers or variables are equal is a common example.

  • For example: The sky is blue = True

Operators:

  • AND: returns true if both of the values being compared are true and returns false if either of the values are false.
  • OR: Returns true if either of the conditions are true. And returns false if both of the conditions are false.
  • NOT: Returns true if the following condition is false. Returns false if it is true.
iswindy = True
result = not(iswindy)
print(result)
False

This uses the NOT operator and I think that it outputs the oposite of what is said. So if iswindy was False, then the output would be True, because it is the opposite

  • Selection: A selection is a decision or a question. At some point in the program, the computer may need to ask a question because it has reached a point where there are one or more options available

  • Algorithm: It is like a recipe. It is lines of codes that a computer follows to solve a problem

  • Condition: They are basically a decision making statement in code.

Conditional Statement part 2: The code below is an example of a conditional statement

for i in range(2):
    password = input("Please enter the password")
    if password == "python" or password == "Python":
        print("Welcome!!")
    else:
        print("This password is incorrect")
Welcome!!
Welcome!!