본문 바로가기

Format3

pre-commit 에서 ‘flake8’ 과 ‘black’ 커스텀 문제 예제 코드 # setup.cfg [flake8] exclude = .git max-line-length = 88 [black] line-length = 88 flake8 과 black 에 ‘line-length’설정 값이 중복되는 것이 아니냐는 의견이 있었습니다. 우선 결론부터 말씀드리자면 둘다 있어야 한다고 생각합니다. 그 이유는 어느 한쪽을 생략한 경우, 생략한 쪽은 기본값을 채택하여 개발자가 원하는대로 작동하지 않기 때문입니다. 예를들어 위에 문서에서 flake8의 ‘max-line-length = 88’ 를 생략하는 경우 # 코드 수정 [flake8] exclude = .git # max-line-length = 88 black은 88자를 통과시키지만 flake8은 기본값인 79자를 기준으로 검사.. 2022. 4. 7.
Sum of the first nth term of Series Description: Task: Your task is to write a function which returns the sum of following series upto nth term(parameter). Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +... Rules: You need to round the answer to 2 decimal places and return it as String. If the given value is 0 then it should return 0.00 You will only be given Natural Numbers as arguments. Examples:(Input --> Output) 1 --> 1 --> "1.00.. 2022. 3. 29.
Human Readable Time 문제 설명 Write a function, which takes a non-negative integer (seconds) as input and returns the time in a human-readable format (HH:MM:SS) HH = hours, padded to 2 digits, range: 00 - 99 MM = minutes, padded to 2 digits, range: 00 - 59 SS = seconds, padded to 2 digits, range: 00 - 59 The maximum time never exceeds 359999 (99:59:59) You can find some examples in the test fixtures. 해결 방법 1. seconds를 .. 2022. 2. 20.