flag or for-else
📌 flag or for-else 자연수 5개를 받아, 숫자를 차례로 곱해 나온 제곱수가 되면 found를, 그렇지 않으면 not found 출력 내가 푼 코드 import math numbers = [int(input()) for _ in range(5)] answer = 1 flag = False for number in numbers: answer *= number if math.sqrt(answer) == int(math.sqrt(answer)): flag = True print("found") break if not flag: print("not found") Flag 변수 이용 import math if __name__ == '__main__': numbers = [int(input()) fo..
python
2021. 4. 3. 22:08
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 양방향 연결 리스트
- 파이썬
- postfix notation
- 스택
- string module
- Django
- sequence type
- airbnb clone
- tailwind
- 의존 주입
- valid annotation
- 선형 배열
- ljust
- python flag
- for-else
- djnago
- python
- initBinder
- most_common
- 선형 탐색
- Stack
- ValidataionUtils
- springboot
- 이진 탐색
- 직접 주입
- 스프링부트
- rjust
- divmod
- 출력 형식 지정
- 자료구조
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함
