GithubHelp home page GithubHelp logo

slfagrouche / number-range-counter Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2 KB

This function counts numbers within a range with a specified increment value. The range can be inclusive or exclusive of the end value.

Python 100.00%

number-range-counter's Introduction

count_inc_end

This function counts from start to end with an increment of inc. If is_exclusive is True, the end value is excluded from the count. If start is equal to end, the function returns None if is_exclusive is True, else it prints start.

## Signature
def count_inc_end(start: int, end: int, inc: int, is_exclusive: bool) -> None:
    """
    Count from `start` to `end` with an increment of `inc`.
    If `is_exclusive` is `True`, the `end` value is excluded from the count.
    If `start` is equal to `end`, the function returns `None` if `is_exclusive` is `True`, else it prints `start`.

    Args:
    start (int): the starting value of the count
    end (int): the ending value of the count
    inc (int): the increment value for each step of the count
    is_exclusive (bool): whether or not to exclude the end value from the count

    Returns:
    None

    Example:
    count_inc_end(2, 5, 1, False)
    # Output: 2 3 4 5
    """
    # function implementation here

      """
      

## Usage
This funtion can be used in any Python script that requires counting numbers within a range. Here are some examples of how to use it:

   # Import the function
  import count_inc_end

   # Count from 5 to 2 with an increment of 2, excluding the end value
  count_inc_end(5, 2, 2, True)

   # Count from 2 to 5 with an increment of 2, including the end value
  count_inc_end(2, 5, 2, False)

   # Count from -3 to -7 with an increment of 1, excluding the end value
  count_inc_end(-3, -7, 1, True)

   # Count from 2 to 5 with an increment of 1, including the end value
  count_inc_end(2, 5, 1, False)

   # Count from 5 to 2 with an increment of 2, including the end value
  count_inc_end(5, 2, 2, False)

   # Count from 6 to 2 with an increment of 2, including the end value
  count_inc_end(6, 2, 2, False)

## Contributing
If you find any bugs or issues with the count_inc_end function, feel free to open an issue or submit a pull request. We welcome contributions from the community.

number-range-counter's People

Contributors

slfagrouche avatar

Watchers

 avatar

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.