# 3 examples of 'split number into digits python' in Python

Every line of 'split number into digits python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure. ## All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
``143def split_decimal(value):144    import decimal145    decimal.getcontext().prec = 2146    d = decimal.Decimal(value)147    i = int(d)148    return (i, d - i)``
``68def splitnum(self, value):69    for elem in self.cards:70        if elem > value:71            continue7273        out = []74        if value == 0:75            div, mod = 1, 076        else:77            div, mod = divmod(value, elem)7879        if div == 1:80            out.append((self.cards, 1))81        else:82            if div == value:  # The system tallies, eg Roman Numerals83                return [(div * self.cards[elem], div*elem)]84            out.append(self.splitnum(div))8586        out.append((self.cards[elem], elem))8788        if mod:89            out.append(self.splitnum(mod))9091        return out``
``84def _check_digit(number):85    """Calculate a single check digit on the provided part of the number."""86    weights = (13, 15, 12, 5, 4, 17, 9, 21, 3, 7, 1)87    s = sum(w * (int(n) if n.isdigit() else alphabet.find(n) + 1)88            for w, n in zip(weights, number))89    return 'MQWERTYUIOPASDFGHJKLBZX'[s % 23]``