What will be the output of the following Python code? [code]import datetime d=datetime.date(2016,7,24) print(d)[/code]

Man Ly

New member
What will be the output of the following Python code?
Code:
import datetime
d=datetime.date(2016,7,24)
print(d)
A. Error
B. 2017-07-24
C. 2017-7-24
D. 24-7-2017
 
Answer: b
Explanation: In the snippet of code shown above, we are simply printing the date entered by us. We enter the date in the format: yyyy,m,dd. The date is then printed in the format: yyyy-mm-dd. Hence the output is: 2017-07-24.
 

Tìm kiếm

Back
Top