Cards (24)

  • What types of data can Python operators be used with?
    Numbers, strings, boolean, and more
  • What are comparison operators used for in Python?
    To compare the values of two operands
  • How are strings compared in Python?
    Based on the alphabetical order of characters
  • What are the comparison operators in Python?
    • Greater than: >
    • Less than: <
    • Equal to: ==
    • Not equal to: !=
    • Greater than or equal to: >=
    • Less than or equal to: <=
  • What does the Greater Than Operator do?
    Returns True if left operand is greater
  • What does the Less Than Operator do?
    Returns True if left operand is less
  • What does the Equal To Operator return?
    True if both operands are equal
  • What does the Not Equal To Operator return?
    True if operands are not equal
  • What does the Greater Than or Equal To Operator do?
    Returns True if left operand is greater or equal
  • What does the Less Than or Equal To Operator do?
    Returns True if left operand is less or equal
  • What will Python return when comparing 2 and 2?
    True
  • What does the Greater Than Operator return if the left operand is not greater?
    Returns False
  • What does the Less Than Operator return if the left operand is not less?
    Returns False
  • What are conditional statements in Python used for?
    • Execute code based on conditions
    • Control the flow of a program
    • Make programs behave differently in situations
  • What is the simplest form of a conditional statement in Python?
    If statement
  • What does an if statement do?
    Executes code if the condition is true
  • What is a shorthand if statement?
    A single-line if statement
  • What does the else statement do?
    Executes code if the if condition is false
  • What is the purpose of the elif statement?
    To check multiple conditions
  • What does nested if…else mean?
    An if-else inside another if statement
  • What is a ternary conditional statement?
    A compact way to write an if-else condition
  • What is the significance of indentation in Python?
    • Defines a group of statements
    • Often referred to as a suite
    • Controls the flow of execution
  • What is a sample problem involving if statements?
    • Ask user for effort mark
    • Display meaning (O, S, NI)
  • What is a sample problem involving elif statements?
    • Determine Conduct Mark based on demerit points
    • Use ranges for A, B, C, D