Bird
Raised Fist0

Which of the following is the correct syntax to import only the sqrt function from the math module?

easy📝 Syntax Q12 of Q15
Python - Modules and Code Organization
Which of the following is the correct syntax to import only the sqrt function from the math module?
Afrom math import sqrt
Bimport math.sqrt
Cimport sqrt from math
Dfrom sqrt import math
Step-by-Step Solution
Solution:
  1. Step 1: Recall import syntax for specific functions

    To import a specific function, use from module import function.
  2. Step 2: Match syntax to options

    from math import sqrt matches this syntax: from math import sqrt.
  3. Final Answer:

    from math import sqrt -> Option A
  4. Quick Check:

    Specific import uses 'from module import item' = A [OK]
Quick Trick: Use 'from module import name' to import parts [OK]
Common Mistakes:
MISTAKES
  • Using dot notation in import statement incorrectly
  • Swapping module and function names
  • Using 'import' with 'from' in wrong order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes