본문 바로가기
Pages

[Python] Control Structure and Control Flow

by ds31x 2023. 10. 6.

Control structure와 Control Flow란 무엇인가?

http://ds31x.blogspot.com/2023/07/basic-control-structures-and-control.html

 

Basic : Control Structures and Control Flow

Control Structure 프로그램을 구성하는 statement (=excutable code)들이 실행되는 순서를 제어하는 방법을 abstraction한 것이 control structure이며 이를 통해 실행순서를 제어하는 것을 flow co...

ds31x.blogspot.com


조건 분기

if, elif, else

2023.07.28 - [Python] - [Python] Boolean Operators, Relational Operators, and Membership Operator

 

[Python] Boolean Operators, Relational Operators, and Membership Operator

Boolean Operators 기본 boolean operator는 다음 3가지로 구성됨. and : and 연산자. (binary op.) : C언어 등에선 &&에 해당. or : or 연산자. (binary op.) : || 에 해당. not : not 연산자. (unary operator로 operand가 하나임.) :

ds31x.tistory.com

2023.07.28 - [Python] - [Python] if, elif, else statements

 

[Python] if, elif, else statements

프로그램의 flow control를 담당함. (loop문과 함께) Flow control을 위한 Control Structures에 대한 내용은 다음 URL을 참고. http://ds31x.blogspot.com/2023/07/basic-control-structures-and-control.html C언어의 if, else if, else 와

ds31x.tistory.com


반복문

while

2023.07.28 - [Python] - [Python] while statement, break and continue

 

[Python] while statement, break and continue

Python의 경우, loop structure로 while statement와 for statement를 제공한다. Contol Flow와 Control Structure에 대한 개념은 다음 URL을 참고 : http://ds31x.blogspot.com/2023/07/basic-control-structures-and-control.html 참고로 do-while

ds31x.tistory.com


for

https://dsaint31.tistory.com/573

 

[Python] for statement

for statement는 loop를 위한 control structure의 대표격이다. Python에서는 iterable 객체 (주로 collection type의 객체들)이 가지고 있는 item들을 iterate하는 용도로 사용된다. 프로그래밍을 배울 때, 구구단 출력

dsaint31.tistory.com


else (break checker)

2023.09.18 - [Python] - [Python] else : break checker

 

[Python] else : break checker

일반적으로 else의 경우, 앞서의 if 와 elif문들에서 실행된 block이 없는 경우 수행되는 것을 의미한다. 그런데 python에서는 for와 while과 같은 loop structure 에서도 else를 뒤에 붙여서 break로 해당 loop가

ds31x.tistory.com


관련 classes

https://dsaint31.tistory.com/502

 

[Python] range and enumerate

엄밀하게 애기하면, range 는 숫자들의 immutable sequence를 나타내는 built-in type이다. 즉, 흔히 built-in function으로 애기하는 range() 는 사실은 range class의 instance를 생성하는 생성자에 해당한다. sequence는

dsaint31.tistory.com

https://dsaint31.tistory.com/501

 

[Python] Iterable and Iterator, plus Generator

Iterable for 문에서 in 뒤에 위치하여 iterate (반복, 순회)가 가능한 object를 가르킴. __iter__() 라는 special method를 구현하고 있으며, 이를 통해 자신에 대한 iterator object를 반환할 수 있음. __iter__() special

dsaint31.tistory.com

 

728x90

'Pages' 카테고리의 다른 글

[Python] String : 문자열  (1) 2023.10.06
[Python] function 과 Scope, Name Space 정리  (0) 2023.10.06
[Python] Collections  (0) 2023.10.06
Shell 관련 정리  (0) 2023.10.02