기타제어문
-
Python Chapter05방뚝딱 학습노트 2023. 10. 17. 12:25
교재 : 멘토씨리즈 파이썬 비시퀀스와 for문 - 126P 예제1) 실행 할때마다 순서가 변경된다. 예제2) 예제3) 예제4) 예제5) 예제6) 기타 제어문 - 134p break문은 while문이나 for문과 같은 반복문을 강제로 종료하고자 할때 사용하는 제어문 입니다. 반복문 내에 break가 나타나면 곧바로 break문이 포함된 반복문은 종료됩니다. 0이 되었을 때 종료해준다. 예제) continue - 138p continue는 만나면 반복문의 조건식으로 이동합니다. continue 이용하는 경우 1. 반복에서 제외시킬 때 ex)1~100까지 더하는 데 3의 배수는 제외하고 더하기 2. 중복 체크 같은 단어나 숫자를 받으면 리스트에 추가하지 않고 조건식으로 돌아가기 예제) 예제) 예제)