본문 바로가기
python-algorithm

leetcode 1154. Day of the Year

by 무적김두칠 2022. 4. 18.

1
2
3
4
5
6
import datetime
class Solution:
    def dayOfYear(self, date: str-> int:
        year,month,days=map(int, date.split('-'))
        ans=datetime.date(year,month,days).timetuple().tm_yday
        return ans
cs
반응형

댓글