[python] if, else if, else 샘플

파이썬의 조건문 구문 중 하나인 if문의 샘플 코드입니다.


x = 34234
if x % 5 == 0:
    print('x is divisible by 5')
elif x % 6 == 0:
    print('x is divisible by 6')
elif x % 7 == 0:
    print('x is divisible by 7')
else:
    print('x is not divisible by 5, 6, or 7')


끝.


댓글

이 블로그의 인기 게시물

공압 속도 제어: 미터인 vs 미터아웃

NPN, PNP 트랜지스터 차이점

[PLC] 센서 NPN, PNP 출력 타입별 결선방법 (OMRON E2E-X 시리즈 3선식 배선)

[PLC] PLC 아날로그 입출력 기본

[주식] 한국거래소(KRX) 데이터 API 입문 가이드

[투자] ETF 투자 가이드 : 카테고리별 ETF 선택 전략

[아두이노] 가변저항(Potential Divider)과 전압분배(Voltage Divider)

[PLC] 릴레이 자기유지 (Realy Latch or Sealing)

[PLC] 릴레이와 전자 접촉기 (MC)

[투자] 기하 브라운 운동(Geometric Brownian Motion)이란?