Bird
Raised Fist0

Which of the following is the correct syntax to import the datetime module in Python?

easy📝 Syntax Q3 of Q15
Python - Standard Library Usage
Which of the following is the correct syntax to import the datetime module in Python?
Arequire datetime
Binclude datetime
Cusing datetime
Dimport datetime
Step-by-Step Solution
Solution:
  1. Step 1: Recall Python import syntax

    Python uses the keyword 'import' to bring in modules.
  2. Step 2: Check each option

    Only 'import datetime' is valid Python syntax; others are invalid.
  3. Final Answer:

    import datetime -> Option D
  4. Quick Check:

    Correct import syntax = import [OK]
Quick Trick: Use 'import module_name' to include modules [OK]
Common Mistakes:
MISTAKES
  • Using 'include' or 'require' which are not Python keywords
  • Forgetting 'import' keyword

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes