Metadata-Version: 2.4
Name: FluCutie
Version: 1.2.1
Summary: A simple library that adds missing functions for working with numbers and lists.
Author-email: Flu3f <belownekit1@gmail.com>
License: MIT
Keywords: utils,lists,numbers,helpers
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

**FluCutie Library v1.2.1 Documentation**



**## 1. Type Conversion Utilities**



**### toList**

Converts a numeric value into a list of its constituent digits or characters.



Input: 

\- A number (int or float).

\- An optional mode selector (default: 'number').

&#x20; - If 'number': Extracts digits and decimal points. Non-numeric characters are ignored. Digits are stored as integers, dots as strings.

&#x20; - If 'string': Converts the number to a string and splits it into a list of individual character strings.



Output: A list containing integers (digits) and/or strings (dots/characters).



Constraints: Input must be a number. Invalid mode selectors raise an error.



**### toNum**

Reconstructs a numeric value from a list of digits/characters.



Input: A list containing elements that can be interpreted as digits or a decimal point (.).



Output: An int or float.



Constraints: 

\- The list must contain at least one valid digit.

\- Multiple decimal points are not allowed.

\- Trailing decimal points are ignored (result becomes an integer).



**### toWord**

Concatenates all elements of a list into a single string.



Input: A list of any elements.



Output: A str.



\---



**## 2. Validation \& Checks**



**### is\_sorted**

Checks if a list is sorted in ascending order.



Input: A list.



Output: bool (True if sorted, False otherwise).



**### is\_number**

Checks if a value is a numeric type.



Input: Any value.



Output: bool (True if int or float).



**### is\_palindrome**

Checks if a number or string reads the same forwards and backwards.



Input: An int, float, or str.



Output: bool.



Note: For numbers, the check is performed on the digit sequence.



**### is\_prime**

Determines if an integer is a prime number.



Input: An int.



Output: bool.



Constraints: Input must be an integer. Numbers less than 2 return False.



**### is\_matrix**

Checks if an object is an instance of the Matrix class.



Input: Any object.



Output: bool.



**### is\_perfect\_square**

Checks if a number is a perfect square.



Input: A number (int or float).



Output: bool.



Constraints: Input must be numeric.



\---



**## 3. List Operations**



**### delRepeat**

Removes duplicate elements from a list while preserving the original order of first occurrence.



Input: A list.



Output: A new list with unique elements.



**### same**

Checks if two lists contain the exact same elements with the same frequencies (order independent).



Input: Two lists.



Output: bool.



Constraints: Both inputs must be lists. If lengths differ, returns False immediately.



**### flatten**

Recursively flattens a nested list structure into a single-level list.



Input: A list (potentially nested).



Output: A flat list.



**### chunks**

Splits a list into smaller sub-lists of a specified size.



Input: 

\- A list.

\- An int representing the chunk size (must be positive).



Output: A list of sub-lists.



Constraints: Chunk size must be a positive integer.



**### rotate**

Rotates list elements to the left by a specified number of steps.



Input: 

\- A list.

\- An int representing the number of steps.



Output: A new list with rotated elements.



Note: Negative steps or steps larger than the list length are handled via modulo arithmetic.



**### find\_duplicates**

Identifies elements that appear more than once in the original list compared to its unique version.



Input: A list.



Output: A list containing the duplicate instances.



**### same\_quantity**

Checks if all unique elements in the list appear the same number of times.



Input: A list.



Output: bool.



Note: An empty list returns True.



**### mode**

Finds the most frequent element in the list.



Input: A list.



Output: The most common element, or None if all elements have the same frequency (balanced).



Constraints: List cannot be empty.



**### median**

Calculates the statistical median of a list of numbers.



Input: A list of numbers.



Output: float or int (the median value).



Constraints: List cannot be empty.



**### difference**

Returns elements present in the first list but not in the second, respecting counts (multiset difference).



Input: Two lists.



Output: A list of remaining elements from the first list.



**### increase**

Adds a value to elements of a list.



Input: 

\- A list of numbers.

\- A value: either a single number or another list of numbers.



Output: A new list with added values.



Behavior:

\- If value is a number: Adds it to every element.

\- If value is a list: Adds element-wise. Operations align by index.



**### subtract**

Subtracts a value from elements of a list.



Input: 

\- A list of numbers.

\- A value: either a single number or another list of numbers.



Output: A new list with subtracted values.



**### multiply**

Multiplies elements of a list by a value.



Input: 

\- A list of numbers.

\- A value: either a single number or another list of numbers.



Output: A new list with multiplied values.



**### safe\_get**

Safely retrieves an element from a list by index.



Input: 

\- A list.

\- An int index.

\- An optional default value to return if the index is out of bounds.



Output: The element at the index, or the default value.



\---



**## 4. Number Operations**



**### numLen**

Counts the number of digits in a number.



Input: 

\- A number (int or float).

\- An optional token: 'before' (digits before decimal), 'after' (digits after decimal), or None (total digits).



Output: An int representing the count.



Note: Signs and decimal points are excluded from the count.



**### between**

Checks if a number lies within the range defined by two other numbers (inclusive).



Input: Three numbers (value, bound1, bound2).



Output: bool.



**### digit\_sum**

Calculates the sum of all digits in a number.



Input: A number (int or float).



Output: An int (sum of digits).



**### f (Factorial)**

Calculates the factorial of a non-negative integer.



Input: An int (>= 0).



Output: An int.



Constraints: Input must be a non-negative integer.



**### reverse**

Reverses the digits of a number or the characters of a string.



Input: An int, float, or str.



Output: 

\- If number: A reversed number (int or float).

\- If string: A reversed string.



**### clamp**

Restricts a number to lie within a specified range.



Input: A number (value), a lower bound, and an upper bound.



Output: The clamped number.



Behavior: Returns the lower bound if value is smaller, upper bound if larger, otherwise the value itself.



**### seconds\_to\_hms**

Converts seconds into a formatted time string H:M:S.



Input: A number (seconds).



Output: A str in format "H:M:S".



**### minutes\_to\_hm**

Converts minutes into a formatted time string H:M.



Input: A number (minutes).



Output: A str in format "H:M".



\---



**## 5. Matrix Class**



The Matrix class represents a 2D grid of data.



**### Initialization**

Input: 

\- data: A flat list of elements.

\- rows: int (number of rows).

\- cols: int (number of columns).



Constraints: rows \* cols must equal the length of data.



**### Access**

Input: A tuple (index1, index2) or (index, specifier).

\- If specifier is 'row': Returns the entire row at index.

\- If specifier is 'column': Returns the entire column at index as a list.

\- Otherwise: Returns the element at \[row]\[col].



Output: Element, row list, or column list.



**### Methods**



**#### show()**

Prints the matrix to the console in a formatted grid.



**#### change\_direction()**

Transposes the matrix (swaps rows and columns).



Output: A new Matrix object.



**#### move(num1, num2, det)**

Swaps two rows or two columns.



Input: Two indices (int) and a direction specifier ('row' or 'column').



Output: A new Matrix object with swapped lines.



**#### Arithmetic Operations (+, -, \*)**

Supports operations with scalars or other matrices.



\- Scalar: Applies the operation to every element.

\- Matrix: Element-wise operation.



Constraints: For matrix-matrix operations, dimensions must match exactly.



Output: A new Matrix object.



**#### rotate()**

Rotates the matrix 90 degrees clockwise.



Output: A new Matrix object.



**#### turn()**

Rotates the matrix 180 degrees.



Output: A new Matrix object.



**#### max() / min()**

Finds the maximum or minimum value in the matrix.



Output: The extreme value.



**#### contains\_string()**

Checks if any element in the matrix is a string.



Output: bool.



**#### sum()**

Calculates the sum of all elements.



Output: 

\- If numeric: int or float.

\- If contains strings: Concatenated str.



**#### flip(val)**

Flips the matrix horizontally or vertically.



Input: 'horizontal' or 'vertical'.



Output: A new Matrix object.



**#### fill(val)**

Creates a new matrix of the same dimensions filled with a specific value.



Input: The value to fill.



Output: A new Matrix object.



**#### trace()**

Calculates the trace of a square matrix (sum of diagonal elements).



Output: Sum of diagonal elements (number or concatenated string).



Constraints: Matrix must be square.



**#### get\_diagonal()**

Extracts the main diagonal elements.



Output: A list of diagonal elements.



Constraints: Matrix must be square.



\---



**## 6. Matrix Helpers**



**### zeros(rows, cols)**

Creates a matrix filled with zeros.



Input: int rows, int cols.



Output: Matrix object.



**### identity(num)**

Creates an identity matrix (1s on diagonal, 0s elsewhere).



Input: int size (for a num x num matrix).



Output: Matrix object.

