본문 바로가기

Python 문법

Python 문법 - break, range, while

# break a loop / continue

# 자신을 감싸고 있는 루프의 { } 괄호를 벗어난다. break() is used to exit a for loop or a while loop

# 루프의 처음 조건으로 돌아간다. continue() is used to skip the current block, and return to the "for" or "while" statement.

 

# range 함수

#range() 함수는, 숫자 리스트를 만들어 준다.

#range() 함수는, 인덱스가 0 부터 시작한다.

#레인지의 괄호 안에 적는 숫자 갯수만큼 만든다.

#Example: range(0, 10) generates integers from 0 up to, but not including, 10.

# While Loops

# while loop 는 조건식을 만족하는 동안

# 자신이 포함하는 문장들을 실행한다.