Python implementation of a default List using linked list
Project description
linkedpy
linkedpy
is a simple linked list implementation in Python, providing a custom List
class with various methods for managing linked list operations.
Features
-
Basic Operations:
append(value)
: Add a value to the end of the list.insert(index, value)
: Insert a value before the specified index.remove(value)
: Remove the first occurrence of a value.pop(index=None)
: Remove and return an item at a specified index (default is the last item).clear()
: Remove all items from the list.
-
Access and Indexing:
__getitem__(index)
: Get the item at a specific index.__setitem__(index, value)
: Set the item at a specific index.__delitem__(index)
: Delete the item at a specific index.
-
Information and Iteration:
count()
: Return the number of items in the list.__len__()
: Return the number of items in the list.to_list()
: Return the list as a normal Python list.__repr__()
: Return a string representation of the list.__iter__()
: Iterate over values in the list.
-
Concatenation:
__add__(other)
: Concatenate two lists using the+
operator.__iadd__(other)
: In-place concatenation using the+=
operator.
-
Statistical Operations:
min()
: Return the minimum value in the list.max()
: Return the maximum value in the list.
Usage
from linkedpy import List
# Create a new list
my_list = List(1, 2, 3)
# Append values
my_list.append(4)
my_list.append(5)
# Access elements
print(my_list[2]) # Output: 3
# Remove element
my_list.remove(2)
# Iterate over the list
for item in my_list:
print(item)
# Concatenate lists
new_list = my_list + List(6, 7, 8)
# In-place concatenation
my_list += List(9, 10)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
linkedpy-0.0.8.tar.gz
(3.5 kB
view details)
Built Distribution
File details
Details for the file linkedpy-0.0.8.tar.gz
.
File metadata
- Download URL: linkedpy-0.0.8.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19a10d4dd185a7a9588c2563827d1b41f7762d3af2f223a307a45637572097a9 |
|
MD5 | c033f7a2c3682f963e88af11d9900b96 |
|
BLAKE2b-256 | 1d3a9b6a8b9bd35186dfac335e6252d601bb9a5093e1f6362447a7a25b11e52a |
File details
Details for the file linkedpy-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: linkedpy-0.0.8-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b498f2bee6e4db73209dd75c3046aa6eda623720ca9bb1bda52df61f80ba800f |
|
MD5 | 3fc28c018e72efe255fd7a0803237d97 |
|
BLAKE2b-256 | 228b7e6727c5d08feb0fce7a4308dbf302647cad8b4ab0861a0865cdce704bd5 |