본문 바로가기

Python

(20)
Python_G-005. Loop Type Loop TypeDescriptionExampleOutputFor LoopIterates over a sequence (e.g., list, tuple, string)fruits = ["apple", "banana", "cherry"] for fruit in fruits:     print(fruit) # Outputapplebananacherry While LoopRepeats as long as a condition is truecount = 0 while count     print(count)     count += 1# Output01234Nested LoopsLoop inside another loopnumbers = [1, 2, 3] letters = ['a', 'b', 'c'] for nu..
Python_G-004 : 10 basic operations & functions 10 Basic OperationsBasic math operations2 + 3, 5 - 1, 4 * 2, 8 / 2, 5 % 2   # output 1 Assign values to variablesa = 5, b += 3    # b = b+3c *= 2     # c = c*2 Compare valuesa == b    # equala != b     # not equala > ba  Logical operationsa and ba or bnot a Bit-level operationsa & b, `ab,a ^ b,~a,a > b`Test for membership in sequences'a' in 'abc', 3 not in [1, 2, 4] Compare object identitiesa is..
Python_G-003 : Variable Type Variable TypeDescriptionExampleintinteger-3, 0, 34, ...floatreal-23.43, 4.56 ...strstring"hello"boolTrue or FalseTrue or 1 , False or 0listsequence[1, 2, 3, 'four', 5.3]tuplesequence(1, 2, 3, 'four', 5.3)dictsequence{'key': 'value'}  ex)  {'name': 'Alice', 'age': 30, 'profession': 'Engineer'}setsequence{1, 2, 3, 'four', 5.3}  List vs (1D) arrayTypeBuilt-in Python data typeProvided by the NumPy l..
Python_G-002 : 10 basic Libraries NumPyNumerical computing and working with arrays- High-performance multidimensional array objects- Mathematical functions for fast operations on arraysPandasData manipulation and analysis- DataFrame for handling tabular dataFunctions for data cleansing, manipulation, and analysisMatplotlibCreating visualizations- Extensive plotting capabilities- Customizable plots including line, scatter, bar, h..