Git Product home page Git Product logo

rsw_py_sll's Introduction

rsw_py_sll

A Python3 MutableSequence, polymorphic singly linked list (for educational purposes) offering:

  • creation with any number of items: s1 = Sll(0, 1, 2); s2 = Sll()

  • numeric indexing of list items (0 or greater): s[0]

  • iteration: for item in s1

  • emptiness and boolean truthiness testing:
    s1.is_empty() returns False; s2.is_empty() returns True
    s1 and not s2 returns True

  • containment for finding if an item is in the list: if 2 in s1: print("found it")

  • concatenation with '+': s1 + s2

  • duplication and extending with '*': s1 * 2 returns Sll[0, 1, 2, 0, 1, 2]

  • prepending and extending by any number of items:
    s1.prepend(3, 4) returns Sll[3, 4, 0, 1, 2]
    s1.extend(5, 6) returns Sll[3, 4, 0, 1, 2, 5, 6]
    s2.extend(3, 4) returns Sll[3, 4]

  • appending single items: s2.append(5) returns Sll[3, 4, 5]

  • finding an item and returning its sublist: s2.find(4) returns Sll[4, 5]

  • counting item occurrences: s2.count(3) returns 1

  • list or item deletion via 'del': del s1[2] or del s1

  • access to last item or sublist:
    s2.last() returns 5
    s2.last_sublist() returns Sll[5]

  • conversion to a standard Python list of items: s2.items() returns [3, 4, 5]

  • a full set of self-tests: Sll.test().

rsw_py_sll's People

Contributors

rswgnu avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

alphapapa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.