본문 바로가기

Study Note/Python25

Taitanic data analysis Today, I had a personal assignment. It involved coding questions related to passengers using Titanic data.The data was from kaggle. https://www.kaggle.com/competitions/titanic/data?select=train.csv Titanic - Machine Learning from Disaster | Kaggle www.kaggle.com    Data file  I wrote Python code based on this data. It's still quite lacking, and the way I approach coding is very inefficient and c.. 2024. 4. 30.
Python Data Types Python Data Types While I was studying Python, I realized that there are lots of different data types in Python.    Numerical data types are used to represent numbers. They primarily consist of integers and floating-point numbers, used for calculations and numerical operations.  In Python, two main types of numerical data are commonly used:1. Integer:   - Integers represent whole numbers without.. 2024. 4. 25.
Lambda function A lambda function, also known as an anonymous function or a lambda expression, is a concise way to define a small, one-line function in Python. Unlike normal functions, lambda functions are defined without a name and can have any number of parameters, but can only contain a single expression. The syntax for a lambda function is:lambda parameters: expressionHere, parameters are the input values t.. 2024. 4. 5.
10. Purpose of 'while' and 'for in' 1. `while` loop: - Executes a block of code repeatedly as long as a specified condition is true. - The condition is evaluated before each iteration, and if it's true, the loop continues. If it's false, the loop terminates. - Typically used when the number of iterations is not known beforehand. For example, the following code prints the numbers from 0 to 9 as long as `num` is less than 10: num = .. 2024. 4. 2.
9. Method vs Function / Dictionary vs List Method vs Function While studying Python, I try to organize the method of using . or. () through this post because I was confused about how to write . In Python, there are cases where you use a dot (.) when calling a function and cases where you don't. Here are the general rules: Method: When calling an object's method, you use a dot (.). For instance, when invoking the split() method of a strin.. 2024. 3. 28.
8. Function simplification Function simplification The reason for simplifying functions is to make the code more concise and readable. Simplified functions reduce redundant code, decrease unnecessary complexity, and enhance maintainability. Additionally, Simplified functions can improve performance and operate more efficiently. Here is an example of simplification Example 1 Before num = 3 if num % 2 == 0: result = 'even' .. 2024. 3. 27.