What is the output of the following Python code snippet?
from datetime import date, timedelta
print(date(2024, 1, 1) + timedelta(days=10))
-
A
2024-01-10
-
B
2024-01-11
Correct answer
-
C
2024-01-12
-
D
Error
Correct answer
B. 2024-01-11
6 views
Explanation
Adding a timedelta shifts the date.
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ