Topic 2

Cards (18)

  • What are logical operators sometimes called?
    Boolean operators
  • What is the purpose of logical operators?
    To make decisions in groups
  • What does the 'and' operator require to return true?
    Both sides must be true
  • What does the 'or' operator require to return true?
    One side must be true
  • What does the 'not' operator do?
    Inverts the result
  • How are logical operators used in programming?
    With selection and repetition structures
  • What does the example program demonstrate about logical operators?
    It shows output based on conditions
  • What is the range of the 'target' number in the guessing program?
    Between 1 and 10
  • How many guesses does the program allow?
    Three guesses
  • What is a subprogram?
    A self-contained sequence of instructions
  • What is the difference between a function and a procedure?
    A function returns a value; a procedure does not
  • What are values passed to a subprogram's parameters called?
    Arguments
  • What do built-in subprograms in Python do?
    Perform commonly used tasks
  • What must you do to use library subprograms in Python?
    Import the library into your program
  • Name three examples of library subprograms in Python.
    'random', 'math', and 'turtle'
  • What is the purpose of library subprograms?
    To perform specific tasks grouped together
  • What is the significance of the 'length' function in Python?
    It finds the length of a data structure
  • How do subprograms enhance programming?
    By allowing code reuse and organization