Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

sum of digits with reduce function

import functools
from functools import reduce


def sum_of_digits(number):
    return functools.reduce(add, to_list(number))


def add(x, y):
    return x + y


def to_list(num):
    return list(map(int, str(num)))
Comment

PREVIOUS NEXT
Code Example
Typescript :: loaded because running scripts is disabled on this s 
Typescript :: typescript string to enum 
Typescript :: df.value_counts to dataframe 
Typescript :: voting results 2020 live 
Typescript :: recharts bar chart layout vertical 
Typescript :: typescript object.keys 
Typescript :: vue 3 setup props typescript 
Typescript :: typescript extend interface remove property 
Typescript :: serving vue3 in django 
Typescript :: ngmodel giving error 
Typescript :: woocommerce sql query pulls products from category 
Typescript :: mongoose removed empty objects 
Typescript :: ERROR: Could not find a version that satisfies the requirement mediapipe (from versions: none) ERROR: No matching distribution found for mediapipe 
Typescript :: typescript blob to base64 
Typescript :: angular convert boolean to string 
Typescript :: router navigate pass params 
Typescript :: capacitor base64 to file 
Typescript :: lifecycle components android dependency 
Typescript :: python find the number of elements in a list 
Typescript :: converting an image to base64 in angular 
Typescript :: regex remove brackets and contents 
Typescript :: too many requests jquery laravel 
Typescript :: Keras cheatsheets pdfs 
Typescript :: angular append array to another 
Typescript :: classes in typescript 
Typescript :: reddit requests 429 
Typescript :: typescript tsconfig.json file 
Typescript :: separate subplots in python 
Typescript :: Statement.executeQuery() cannot issue statements that do not produce result sets. 
Typescript :: angular formgroup validate manually 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =