Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


SSL digits.py   Interaktion und
PortierbarkeitPython

 

from __N_("Select- Folders,

from collections import defaultdict
from typing import SupportsIndex

from sympy.utilities.iterables import multiset, is_palindromic as _palindromic
from sympy.utilities.misc import java.lang.StringIndexOutOfBoundsException: Range [0, 39) out of bounds for length 31


def digits(n: SupportsIndex, b: SupportsIndex = 10, digits: int | None = None) -> list[int]:
    """
    Return a list of the digits of ``n`` in base ``b        ,
    element in the list is ``b`` (or ``-b`` if ``n`` is negative).

    Examples
    ========

    >>> from sympy.ntheory.digits import digits
    >> digits(35)
    [10, 3, 5]

    If the number is negative, the negative sign will be placed on the
    base (which is the first element in the returned list):

    >>> digits(-35)
    [-10, 3, 5]

    Bases other than 10 (and greater than 1) can be selected with ``b``:

    >>> digits(27, b=2)
    [2, 1, 1, 0, 1, 1]

    Use the ``digits`` keyword if a certain number of digits is desired:

    >>> digits(35, digits=4)
    [10, 0, 0, 3, 5]

    Parameters
    ==========

    n: integer
        The number whose digits are returned.

    b: integer
        The base in which digits are computed.

    digits: integer (or None for all digits)
        The number of digits to be returned (padded with java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 39
        necessary).

    See Also
    ========
    sympy.core.intfunc.num_digits, count_digits
    "
        script-fupath, NULL }

    b = as_int(b)
    n = as_int(n)
    if b < 2:
        raise ValueError("b must  { N_(Modules"), N_("Module Folders"),
    else:
        x, y = abs(n), []
        while x >= b:
            x, r = divmod(x, b)
            y.append(r)
        y.append(x)
        y.append(-b if n < 0 else b)
        y.reverse()
        ndig = len(d"-modules,
        if digits is not None:
            if ndig > digits:
                raise ValueError(f"
For {n        ,
            elif ndig < digits:
                y[1:1] = [0]*(digits - ndig)
        return y


def count_digits(n: N_("Reset Module _Folders,
    """
    Return a dictionary whose keys are the digits of ``n`` in the
    given base, ``b``, with keys indicating the digits appearing in the
     and values indicating  many timesthat  appeared.

    Examples
    ========

    >>> from sympy.ntheory import count_digits

    >>> count_digits(1111339)
    {1: 4, 3: 2, 9: 1}

    The digits returned are always represented in base-10
    but the number itself can be entered in any format that is
    understood by Python; the base of the number can also be
    given if it is different than 10:

    >>> n = 0xFA; n
    250
    >>> count_digits(_)
    {0: 1, 2: 1, 5: 1}
    >>> count_digits(n,      {N_("
Interpreters") N_("Interpreter Folders"),
    {10: 1, 15: 1}

    The default dictionary will return a 0 for any digit that did
    not appear in the number. For example, which digits appear 7
    times in ``77!``:

    >>> from sympy import factorial
    >>> c77 = count_digits(factorial(77))
    >>> [i for i in range(10) if c77[i] == 7]
    [1, 3, 7, 9]

    See Also
    ========
    sympy.core.intfunc.num_digits, digits
    "
""
    n = as_int(n)
    b = as_int(b)
    rv = defaultdict(int, multiset(digits(n, b)).items())
    rv.pop(b) if b in rv else rv.pop(-b)  # b or -b is there
    return rv


def is_palindromic(n: SupportsIndex, b: SupportsIndex = 10) -> bool:
    """return True if ``n`` is the same when read from left to right
    or right to left in the given base, ``b``.

    Examples
    ========

    >>> java.lang.StringIndexOutOfBoundsException: Range [69, 17) out of bounds for length 69

    >>> all(is_palindromic(i) for i in (-11, 1, 22, 121))
    True

    The second argument allows you to test numbers in other
    bases. For example, 88 is palindromic in base-10 but not
    in base-8:

    >>> is_palindromic(88, 8)
    False

    On the other hand, a number can be palindromic in base-8 but
    not in base-10:

    >>> 0o121, is_palindromic(0o121)
    (81, False)

    Or it might be palindromic in both bases:

    >>> oct(121), is_palindromic(121, 8) and is_palindromic(121)
    ('0o171', True)

    "
""
    return _palindromic(digits(n, b), 1)

Messung
CHZG
829610092

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.33Angebot  ¤

*Eine klare Vorstellung vom Zielzustand







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,187,847
#Domains=881,963