#python #anaconda #jupyter-notebook #visual-code #html #css #javascript #http 제목실습 후 만들어본 프로그램 #12018-10-16 12:14작성자PengA년도날짜를 입력 시 그 날의 요일을 알려주는 프로그램입니다.FDR을 처리하였으나 보기 어려우실수도 있지만 내용 중 틀린점이나 수정하면 좋겠다는 점있다고 생각하시는 분 있으면 추가 의견 달아주시면 한 번 노력해보겠습니다.def Month(date): """ (str) -> int or str 1) If the date parameter is 01 (January), return int (13). 2) If it is 02 (February), return int (14). 3) In the other case, return date [4: 6] (month) of date parameter as str type. ex) date = 20181016 date[4:6] -> '10' date = 20180116 date[4:6] -> 13 """ if (date[4:6] == '01'): date = str(int(date[0:4]) -1) + '13' + date[6:8] return 13 elif (date[4:6] == '02'): date = str(int(date[0:4]) -1) + '14' + date[6:8] return 14 else: return date[4:6]def Year_A(date): """ (str) -> str Return the first two digits of the year. ex) date = 20181016 Year_A(date) = 20 """ return date[0:2]def Year_B(date): """ (str) -> str Return the second two digits of the year. ex) date = 20181016 Year_A(date) = 18 """ return date[2:4]def Find_dayofweek(Dof): """ (int) -> str Returns the value of the parameter Dof that indicates the day of the week. Dof == 0 -> 토요일 Dof == 1 -> 일요일 Dof == 2 -> 월요일 Dof == 3 -> 화요일 Dof == 4 -> 수요일 Dof == 5 -> 목요일 Dof == 6 -> 금요일 ex) date = 20181016 Dof = 3 Find_dayofweek(DOF % 7) -> 화요일 """ if (Dof == 0): return '토요일' elif (Dof == 1): return '일요일' elif (Dof == 2): return '월요일' elif (Dof == 3): return '화요일' elif (Dof == 4): return '수요일' elif (Dof == 5): return '목요일' elif (Dof == 6): return '금요일' else: return 'Error'Date = input("요일을 찾을 날짜를 입력하세요(Ex : 19990112) :")DOF = (int(Date[6:8]) + (13 * (int(Month(Date)) + 1) // 5) + int(Year_B(Date)) + (int(Year_B(Date)) // 4) + (int(Year_A(Date)) // 4) - (2 * int(Year_A(Date))))print('해당 날짜의 요일은 ' + Find_dayofweek(DOF % 7) + '입니다.')혹시 여러가지 예제를 던져주시면 같이 만들어보는 것도 좋겠다 생각합니다 ㅎ... 목록수정삭제답변글쓰기 댓글 [8] 댓글작성자(*)비밀번호(*)내용(*) 댓글 등록 더보기이전module 에 관한 질문으ㅏ아2018-10-16다음실습 다하면 김밥천국2018-10-15 Powered by MangBoard | 워드프레스 쇼핑몰 망보드