본문 바로가기

collection5

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.
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.
6. Python collection type - Set 1. Set A set is a Python data structure that stores a collection of unique and unordered values. 1-1. Creation Sets can be created directly by using curly braces {} and listing the elements separated by commas. 1-2. Methods Set has several methods. 2024. 3. 14.
5. Python collection type - Tuple 1. Tuple A tuple is an immutable collection with ordered elements that can store values of various data types. Immutable: After creating tuples, elements cannot be added, deleted, or modified. Efficient: Tuples are more memory-efficient than lists, particularly aiding in performance enhancement when data is infrequently modified. 1-1. Creation Tuple is created using parentheses (), and each item.. 2024. 3. 14.