본문 바로가기

전체 글825

Delete occurrences of an element if it occurs more than n times Description: Enough is enough! Alice and Bob were on a holiday. Both of them took many pictures of the places they've been, and now they want to show Charlie their entire collection. However, Charlie doesn't like these sessions, since the motive usually repeats. He isn't fond of seeing the Eiffel tower 40 times. He tells them that he will only sit during the session if they show the same motive .. 2022. 4. 2.
테스트 주도 개발은 객체지향 설계도구 * 이 글은 책을 읽고 주관적인 생각과 함께 요약 정리한 글입니다. 제목 : 객체지향의 사실과 오해 저자 : 조영호 범위 : 04 역할, 책임, 협력 요약 정리 협력 중요한 것은 개별 객체가 아니라 객체들 사이에 이뤄지는 협력이다. 협력의 본질은 요청과 응답으로 연결되는 네트워크다. 첵임 책임은 객체의 외부에 제공해 줄 수 있는 정보(아는 것) 개인적인 정보에 관해 아는 것 관련된 객체에 관해 아는 것 자신이 유도하거나 계산할 수 있는 것에 관해 아는 것 외부에 제공해 줄 수 있는 서비스(하는 것)의 목록이다. 객체를 생성하거나 계산을 하는 등의 스스로 하는 것 다른 객체의 행동을 시작시키는 것 다른 객체의 활동을 제어하고 조절하는 것 역할 '왕'과 '여왕'이 객체라면 '판사'는 그들의 역할이다. 같은 .. 2022. 4. 1.
Jaden Casing Strings Description: Jaden Smith, the son of Will Smith, is the star of films such as The Karate Kid (2010) and After Earth (2013). Jaden is also known for some of his philosophy that he delivers via Twitter. When writing on Twitter, he is known for almost always capitalizing every word. For simplicity, you'll have to capitalize each word, check out how contractions are expected to be in the example bel.. 2022. 4. 1.
Python _ @classmethod, @staticmethod 란 무엇인가? 파이썬에서 클래스들을 살펴보면 가끔 뜬금없이 데코레이터가 등장하곤 합니다. 바로 @classmethod, @staticmethod 데코레이터입니다. 이 두 데코레이터를 왜 사용하는지 같이 살펴보겠습니다. 우선 다음처럼 클래스 코드를 작성하고 인스턴스를 만들겠습니다. class Robot: number = '0001' def __init__(self, name): self.name = name def 인스턴스메서드(self): print(f'인스턴스메서드 호출 {self.name}') @classmethod def 클래스메서드(cls): print(f'클래스메서드 호출 {cls.number}') @staticmethod def 스태틱메서드(): print('스태틱메서드 호출') robot = Robot('.. 2022. 3. 31.
Complementary DNA Description: Deoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the "instructions" for the development and functioning of living organisms. If you want to know more: http://en.wikipedia.org/wiki/DNA In DNA strings, symbols "A" and "T" are complements of each other, as "C" and "G". You function receives one side of the DNA (string, except for Haskell); you need to.. 2022. 3. 31.
Python _ magic method를 사용하여 객체 커스텀하기 파이썬에는 magic method 라는 것이 있습니다. 흔히 __000__ 형태로 되어 있는 것을 의미하며 이는 파이썬 자체에 내장되어 있는 메서드들입니다. # magic method 예시 '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeo.. 2022. 3. 31.