Q:

Write a NumPy program to count the number of days of specific month

0

Write a NumPy program to count the number of days of specific month.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
print("Number of days, February, 2016: ")
print(np.datetime64('2016-03-01') - np.datetime64('2016-02-01'))
print("Number of days, February, 2017: ")
print(np.datetime64('2017-03-01') - np.datetime64('2017-02-01'))
print("Number of days, February, 2018: ")
print(np.datetime64('2018-03-01') - np.datetime64('2018-02-01'))

Sample Output:

Number of days, February, 2016:                                        
29 days                                                                
Number of days, February, 2017:                                        
28 days                                                                
Number of days, February, 2018:                                        
28 days

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now