1. Home
  2. Data Science
  3. Python
  4. What is the output of the following Python code snippet?

Added 25 Nov 2026

What is the output of the following Python code snippet?

from datetime import date, timedelta
print(date(2024, 1, 1) + timedelta(days=10))
  1. 2024-01-10
  2. 2024-01-11 Correct answer
  3. 2024-01-12
  4. Error

Correct answer

B. 2024-01-11

6 views

MCQSEXAM

Explanation

Adding a timedelta shifts the date.

Reference

Asked in: Python Interview Standard Library

https://docs.python.org/3/library/index.html

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs