본문 바로가기 메뉴 바로가기

programming study

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

programming study

검색하기 폼
  • 분류 전체보기 (120)
    • BOJ (77)
    • 자료구조 & 알고리즘 (8)
    • python (12)
    • spring boot (4)
    • java (2)
    • airbnb-clone - Django (16)
  • 방명록

for-else (1)
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
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
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
  • 출력 형식 지정
  • 자료구조
more
«   2026/04   »
일 월 화 수 목 금 토
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
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바