Given a date , returns number of days elapsed from the beginning of the current year ( 1 stjan ) .
def offsetDays ( d , m , y ) : NEW_LINE INDENT offset = d NEW_LINE switcher = { 10 : 30 , 9 : 31 , 8 : 30 , 7 : 31 , 6 : 31 , 5 : 30 , 4 : 31 , 3 : 30 , 2 : 31 , 1 : 28 , 0 : 31 } NEW_LINE if ( isLeap ( y ) and m > 1 ) : NEW_LINE INDENT offset += 1 NEW_LINE DEDENT offset += switcher . get ( m ) NEW_LINE return offset NEW_LINE DEDENT