본문 바로가기

전체 글164

10. 제어문 - 반복문 1. 반복문 반복문은 동일한 작업을 여러 번 실행하기 위해 사용되는 제어 구조입니다. 주로 for 문과 while 문이 사용되며, 각각의 반복문은 다른 상황에 적합한 방식으로 사용됩니다. for 문: 반복 횟수를 미리 알고 있는 경우에 적합합니다. while 문: 조건이 참인 동안 반복적으로 코드를 실행합니다. 2. while 문 while 문은 특정 조건이 참인 동안 반복적으로 코드 블록을 실행하는 제어 구조입니다. while 문은 주어진 조건이 참인 동안 반복적으로 코드를 실행하며, 조건이 거짓이 되면 반복을 멈춥니다. 3. for문 for 문은 시퀀스(리스트, 튜플, 문자열 등)의 각 항목에 대해 반복 작업을 수행하는 반복문입니다. for 문은 주로 "지정된 범위 내에서 반복"할 때 사용됩니다. 이.. 2024. 3. 14.
9. Conditional Statements in Python 1. Conditional Statements Conditional statements are used to control the flow of execution in a program. They allow different parts of the code to be executed based on whether a specific condition is true or false. 2. If Statement The if statement is the most basic conditional statement. It allows you to execute a code block only if a certain condition is true. 3. Else Statement The else stateme.. 2024. 3. 14.
9. 제어문 - 조건문 1. 조건문 조건문은 코드의 실행 흐름을 제어하기 위해 사용하는 구문입니다. 이 조건문은 주어진 조건이 참인지 거짓인지에 따라 다른 코드를 실행하게 합니다. 2. if문 가장 기본적인 조건문입니다. 특정 조건이 참(True)일 경우에만 해당 블록 내의 코드가 실행됩니다. 3. else 문 else는 파이썬의 조건문 구조에서 if와 elif 조건들이 모두 거짓으로 평가될 경우 실행되는 부분을 정의하는 데 사용됩니다. else는 선택적으로 사용될 수 있으며, 그 자체로는 어떤 조건을 갖지 않습니다. 다시 말해, else 블록은 위의 if와 elif 조건들이 모두 만족되지 않는 경우에만 실행됩니다. 4. elif 문 elif는 if-else 구조에서 추가적인 조건을 검사하기 위해 사용되는 키워드입니다. eli.. 2024. 3. 14.
8. Operator in Python 1. Arithmetic Operators Arithmetic operators are used to perform basic mathematical operations on numeric data types. 2. Comparison Operators Comparison operators are used to compare two values and return a Boolean value (True or False) as a result. 3. Assignment Operators Assignment operators are used to assign values to variables. 4. Bitwise Operators Bitwise operators are operators used when .. 2024. 3. 14.
8. 파이썬 연산자 1. 산술 연산자 산술 연산자는 주로 수치 데이터 유형에 대한 기본 산술 연산을 수행하기 위해 사용됩니다. 2. 비교 연산자 비교 연산자는 주로 두 값을 비교하는 데 사용되며, 그 결과는 항상 불리언(True 또는 False) 값입니다. 3. 할당 연산자 변수에 값을 할당하는데 사용됩니다. 파이썬에서는 기본 할당 연산자 외에도 복합 할당 연산자를 제공하여 코드를 간결하게 작성할 수 있게 도와줍니다. 4. 비트 연산자 비트 연산자는 정수를 이진 비트로 표현했을 때 사용하는 연산자들입니다. 각 연산자는 정수의 비트 단위로 동작합니다. & : 비트 단위 AND | : 비트 단위 OR ^ : 비트 단위 XOR ~ : 비트 단위 NOT > : 오른쪽 시프트 5. 논리 연산자 파이썬에서의 논리 연산자는 주로 불린(.. 2024. 3. 14.
7. Python collection type - Dictionary 1. Dictionary The dictionary is a mutable collection composed of key-value pairs. Key is a unique identifier, and Value is data associated with the key. 1-1. Creation Dictionaries are created using curly braces {}, and key-value pairs are separated by commas ,. Each key-value pair is separated by a colon :. 1-2. Mutability Dictionaries are mutable. That is, the user can add, remove or change exi.. 2024. 3. 14.