boolean data type, relational operators, selections

Cards (35)

  • What is a conditional statement?
    A statement that performs different actions based on whether a condition is true or false
  • How does a conditional statement determine which action to take?
    It evaluates whether the condition is true or false
  • What are the two possible values of a Boolean data type?
    True or False
  • What are relational operators used for?
    • To compare two numbers
    • Returns a Boolean value of either True or False
  • What does the relational operator "==" signify?
    Equal to
  • What does the relational operator "!=" signify?
    Not equal to
  • What does the relational operator "<" signify?
    Less than
  • What does the relational operator "<=" signify?
    Less than or equal to
  • What does the relational operator ">" signify?
    Greater than
  • What does the relational operator ">=" signify?
    Greater than or equal to
  • What is the purpose of program execution and flow control?
    To control which instruction should be executed next
  • What is the default flow of program execution?
    Defined by the "sequence" concept, executing instructions one after another
  • What is selection (branching) in programming?
    When an algorithm makes a choice to do one of two or more things
  • What is the most common programming statement used for branching?
    IF statement
  • What does an IF statement do?
    Executes a block of code if the conditional expression is true
  • What is the structure of an IF statement in pseudocode?
    • IF conditional expression is True
    • THEN DO THIS
    • END IF
  • Why is proper indentation important in programming?
    It improves code readability and indicates the structure of the code
  • What is the designated name for the Boolean data type in Python?
    bool
  • What is a statement in Python?
    • Each line of code in a Python program
    • Interpreted and run one by one
  • What does the backslash "\" signify in Python?

    It is used to continue a statement onto the next line
  • What is the purpose of comments in Python?
    To provide information and improve code readability
  • How does Python handle comment lines?
    Anything after the pound sign "#" is ignored during interpretation
  • What is an interpreter error in Python?

    An error that occurs when the syntax of the code is invalid or malformed
  • What is the built-in function used to get user input in Python?
    input
  • What does the input function do?
    It prints a message and waits for the user to type something
  • What does the input function do in Python?

    It prompts the user for input and returns it as a string.
  • What happens when a string is converted to a float in Python?
    The string representation of a number is converted into a floating-point number.
  • What does the print() function do in Python?

    It displays messages and data on the shell screen.
  • What is the purpose of whitespace in Python?
    Whitespace separates words in a statement and improves code readability.
  • What is the purpose of indentation in Python?
    It is used for grouping statements and improving code readability.
  • What is a Boolean expression in Python?

    A Boolean expression evaluates to either True or False.
  • What does an IF statement do in Python?
    It executes a block of code if a specified condition is True.
  • How does the indentation affect the execution of an IF statement in Python?

    Indentation defines the scope of the block that will execute if the condition is True.
  • What is the purpose of comments in Python code?
    Comments are ignored during interpretation and are used to explain the code.
  • What are the key terminologies in Python programming discussed in the material?
    • Boolean: Either True or False.
    • Statement: A line of code.
    • Comment: Indicated by a “#” and ignored during interpretation.
    • Whitespace: Separates words in a statement.
    • Indentation: Leading whitespace for grouping and readability.