Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help!!! write the below functions in python. 1)multiply until total reached 2)all primes 3)count 2d Functions sum of digits(n): Given a non-negative integer n, calculate

Help!!! write the below functions in python.

1)multiply until total reached

2)all primes

3)count 2d

image text in transcribed

Functions sum of digits(n): Given a non-negative integer n, calculate and return the sum of all its digits o Assume: n is a non-negative integer. o Return value: an integer. o Examples sum of digits (e) e only digit i e sum of digits(204) 6 tt 2+e+4 6 multiply until total_reached(original,total,n): Starting with a positive integer original, keep multiplying original b n and calculate the sum of all multiple generated including original until the sum is no longer smaller than total. Return the minimum number ofmultiplications needed to reach at value at or above the given total o Assume: All three arguments are integers: original and n are positive. o Return value: an integer. o Examples multiply until total reached (1,5,2) 1 2 2, (1+2) 5, 2 2 4, (1+2+4) 5, 2 multiplications needed multiply until total reached (1,15,2) 1 2-2, (1+2)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions