Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
| 31 |
Tags
- analizer
- Dictionary
- 덴드로그램
- sklearn
- count()
- IN
- hierarchical_clustering
- len()
- matplotlib
- data
- pandas
- dendrogram
- 분류 결과표
- insert()
- 반복문
- Machine Learning
- function
- list
- del
- 최솟값
- append()
- elbow method
- DataAccess
- string
- DataFrame
- wcss
- Python
- numpy
- nan
- 최댓값
Archives
- Today
- Total
개발공부
[Python] While 반복문 본문
While
- While loop 는, 조건식을 만족하는 동안, 자신이 포함하는 문장들을 실행한다.
예제 - hello를 7번 출력하기
>>> i = 0
>>> while i < 7 :
>>> print('hello')
>>> i = i + 1
hello
hello
hello
hello
hello
hello
hello
Infinite Loop : 무한루프
- 반복문이 무한히 지속되는 상태를 말한다.
- break를 이용해 빠져나올 수 있다.
예제 - '그만' 이라고 입력할때까지 문자를 입력받고 출력하기
>>> while True :
>>> user_input = input('문장을 입력하세요 : ')
>>> if user_input == '그만' :
>>> break
>>> else :
>>> print(user_input)
문장을 입력하세요 : 가
가
문장을 입력하세요 : 나
나
문장을 입력하세요 : 다
다
문장을 입력하세요 : 그만'Python > Basic' 카테고리의 다른 글
| [Python] Function (함수) 표현, 실행 순서, 예제 (0) | 2022.04.26 |
|---|---|
| [Python] 숫자 리스트를 만들어주는 range() 함수 (0) | 2022.04.25 |
| [Python] 반복문에서 Break, Continue (0) | 2022.04.25 |
| [Python] For 반복문 (0) | 2022.04.25 |
| [Python] if 조건문 (0) | 2022.04.21 |