본문 바로가기

전체 글139

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.
7. 파이썬 컬렉션 타입 - 딕셔너리 1. 딕셔너리 딕셔너리는 키와 값으로 이루어진 변경 가능한 (mutable) 컬렉션입니다. 키는 고유한 식별자이며, 값은 키와 관련된 데이터를 나타냅니다. 1-1. 생성 딕셔너리는 중괄호 {}를 사용하여 생성하고, 키-값 쌍들은 쉼표 ,로 구분됩니다. 각 키-값 쌍은 콜론 :으로 구분됩니다. 1-2. 변경 가능 딕셔너리는 변경 가능합니다. 즉, 키-값 쌍을 추가하거나 제거하거나 기존 값을 변경할 수 있습니다. 키-값 쌍 추가: dict[키] = 값 키-값 쌍 제거: del dict[키] 값 변경: dict[키] = 새로운_값 1-3. 키, 값의 제약 딕셔너리의 키는 변경 불가능한(immutable) 타입이어야 합니다. 예를 들어, 문자열, 정수, 튜플은 딕셔너리의 키로 사용할 수 있지만, 리스트는 딕셔너.. 2024. 3. 14.