Category87 WIL : Weekly I learned Fact I have been consistently practicing Python and SQL, solving various types of problems to become more familiar with different approaches. I am gradually getting used to reading and understanding the code as well. Although SQL is relatively easier than Python, I realize that I need to practice more to be able to utilize them effectively in the future. Feeling I am planning to do the final rev.. 2024. 4. 5. 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. Difference between 'num for num in range' and 'for num in range' (Python) While studying Python, I wondered about 'num for num in range' and 'for num in range'. They seemed similar yet had different use cases, and I needed to understand when to use each in different situations. Here are explanations: 1. `num for num in range` (List Comprehension): # List Comprehension Example: Creating a list with numbers from 0 to 4 my_list = [num for num in range(5)] print(my_list) .. 2024. 4. 2. Difference between list and [] (Python) The difference between `list()` and `[]` lies in their usage and purpose in Python. list(): - `list()` is a built-in Python function used to convert an iterable object into a list. It takes an iterable object (such as a tuple, string, or range) as an argument and returns a new list containing the elements of that iterable. - Example: `list((1, 2, 3))` will return `[1, 2, 3]`. [ ] (square bracket.. 2024. 4. 2. DATE - [SQL} While using SQL, I've always found myself confused about date formats when solving problems related to dates. In the content below, I need to filter data for January, but the function I wasn't the best way. SELECT category, sum(sales) 'Total_sales' from book b inner join book_sales s on b.book_id = s.book_id WHERE sales_Date BETWEEN '2022-01-01' AND '2022-01-31' group by 1 order by category When.. 2024. 4. 1. 이전 1 ··· 8 9 10 11 12 13 14 15 다음