get started with python coursera week 2 quiz answers

Test your knowledge: Functions

1. A data professional wants to define their own Python function. What keyword should they use at the start of the function block?

  • with
  • for
  • return
  • def

2. Modularity is the ability to write code in separate components that work together.

  • True
  • False

3. Why do data professionals use comments for their Python code? Select all that apply.

  • To outline the steps of a process
  • To execute code
  • To provide helpful explanations
  • To document their work for teammates

Test your knowledge: Conditional statements

4. Fill in the blank: Comparators are operators that compare two values and produce _____ values.

  • string
  • integer
  • boolean
  • float

5. When comparing two expressions, what logical operator requires both expressions to be true to return a True result?

  • with
  • not
  • or
  • and

6. Which of the following is a reserved keyword that sets up a condition in Python?

  • if
  • as
  • else
  • with

7. The elif keyword only works when there are exactly two possible conditions in the code.

  • True
  • False

Weekly challenge 2

8. A data professional wants to define a function to calculate the volume of a box. What code should they begin with?

  • def volume_box(length, width, height):
  • else volume_box(length, width, height):
  • if volume_box(length, width, height):
  • return volume_box(length, width, height):

Shuffle Q/A 1

9. Which Python keyword makes a function produce new results and save the results for later use?

  • if
  • as
  • return
  • def

10. What are the benefits of using clean code for data work? Select all that apply.

  • Enhance teamwork
  • Save time and effort
  • Eliminate the need for hashtags when commenting
  • Reduce errors

Leave a Reply