The _______ operator returns True if the value on its left is less than the one on its right.

  • Greater than (>)
  • Greater than or equal to (>=)
  • Less than (<)
  • Less than or equal to (<=)
The 'Less than' operator returns True if the value on its left is less than the one on its right.

What is the primary difference between the methods append() and extend() when applied to a list?

  • append() adds one item
  • append() extends lists
  • extend() adds elements
  • extend() appends lists
The primary difference between append() and extend() is that append() adds a single item to the end of a list, while extend() adds the elements of an iterable (e.g., another list) to the end of the list. This means extend() is used to combine two lists, while append() adds an element as it is, even if it's a list itself.

One of the potential issues with excessive nested if statements is reduced ______ of code.

  • modularity
  • performance
  • readability
  • verbosity
One of the potential issues with excessive nested 'if' statements is reduced readability of code due to increased verbosity.

If you have import pandas as pd, what does "pd" represent?

  • It is the author's initials.
  • It stands for "Python Data."
  • It's a common convention for aliasing pandas.
  • It's a random abbreviation for the library.
When you use import pandas as pd, you are creating an alias for the pandas library. "pd" is a commonly used abbreviation for pandas in the Python community, making it easier to reference and use pandas functions and classes in your code without typing the full module name each time.

You have two sets, one containing all employees who attended a training session and another with employees who completed an online assessment. You want to find out who attended the training but did not complete the assessment. Which set operation would help?

  • Difference
  • Intersection
  • Symmetric Difference
  • Union
To find employees who attended training but did not complete the assessment, you would use the "Difference" set operation. This will give you the elements that are in the first set but not in the second.

Which keyword is used to define a function in Python?

  • def
  • define
  • func
  • function
In Python, the keyword 'def' is used to define a function. For example, 'def my_function():' defines a function named 'my_function.'

Which logical operator is used in Python to combine conditional statements and returns True only if one of the conditions is True?

  • and
  • not
  • or
  • xor
The 'or' logical operator in Python is used to combine conditional statements. It returns 'True' if at least one of the conditions is 'True.'

What is the result of the expression type((1,))?

  • int
  • list
  • str
  • tuple
The expression type((1,)) will result in tuple. Even though it has one element, it's still considered a tuple due to the comma after the element.

Why would you want to create a package in Python instead of a single module?

  • To avoid using external libraries
  • To make the code run faster
  • To reduce memory consumption
  • To simplify code organization and reuse
Creating a package in Python is beneficial for code organization and reuse. It allows you to group related modules together, making it easier to manage and maintain your codebase. Packages also support namespaces, which help prevent naming conflicts.

In Python, what term is used when a function is defined inside another function?

  • Inner Function
  • Nested Function
  • Nested Method
  • Subfunction
When a function is defined inside another function, it's called a "nested function." These are also known as inner functions.