본문 바로가기

Python(Eng. ver)24

12. User-Defined Function 1. User-Defined Functions It is functions that you create yourself to perform specific tasks. Python has many built-in functions, but sometimes you need to create a function that behaves exactly as you need it to. This is where user-defined functions come in. 1-1. Functions with no parameters and no return value The simplest form of a function It performs a specific task and the result is printe.. 2024. 3. 15.
11. Collections and Loops 1. List and For loops: A loop is a control structure used to execute the same task repeatedly. The most commonly used loops are the for loop and the while loop, each suited for different situations. 2. Dictionaries and For loops 3. Comprehensions Comprehension is one of the simple ways to create or transform collections such as lists, sets, and dictionaries in Python. Comprehension is a techniqu.. 2024. 3. 15.
10. Loop Statement in Python 1. Loop Statement Loops are control structures used to execute the same task multiple times. They are mainly implemented using for loops and while loops, each suitable for different situations. For Statement: A for loop is suitable when the number of iterations is known in advance. While Statement: Executes code repeatedly while a condition is true. 2. While Statement A while loop is a control s.. 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.