250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- map
- 선형회귀
- 한줄for문
- 가설검정
- Til
- 다중공선성
- 이중for문
- ★
- 태블로
- 데이터시각화
- SQL
- 내배캠_학습기록
- SQLD
- 리스트
- python
- Leetcode
- Max
- 프로그래머스
- 반복문
- DATE_SUB
- 시각화
- 아티클스터디
- 통계학
- 데이터전처리
- Set
- f-string
- AB테스트
- 내일배움캠프
- 내일배움일지
- Join
Archives
- Today
- Total
노력에는 지름길이 없으니까요
프로그래머스 - 점의 위치 구하기 Python ver. 본문
728x90
해결일 | 언어 | 레벨 | 테스트명 |
20240617 | Python | level 0 | 점의 위치 구하기 |
링크 : https://school.programmers.co.kr/learn/courses/30/lessons/120841
내 코드
def solution(dot):
return (2 if dot[0]<0 else 4) if dot[0]*dot[1]<0 else (3 if dot[0]<0 else 1)
개선점: if를 덜 써보고 싶었는데 다른 방법은 생각이 안났음 ㅋㅋ
베스트 코드
def solution(dot):
quad = [(3,2),(4,1)]
return quad[dot[0] > 0][dot[1] > 0]
728x90
반응형
'Python > 프로그래머스' 카테고리의 다른 글
(★)프로그래머스 - 귤 고르기 Python ver. (0) | 2024.07.11 |
---|---|
13일차 (24-07-10) TIL 학습기록 (0) | 2024.07.10 |
프로그래머스 - 숨어있는 숫자의 덧셈 (2) Python ver. (0) | 2024.07.09 |
프로그래머스 - 최빈값 구하기 Python ver. (0) | 2024.07.08 |
프로그래머스 - 암호 해독 Python ver. (0) | 2024.07.08 |