Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

write code using the range function to add up the series 20, 30, 40,...90


Write a program to output the following

^ ^

( o o )

v


Consider the following function mys.

def mys ( ):

If m == 1:

return (1)

else :

return (m*mys(m - 1) )

Which of the following is correct ?

1. The function always terminates with

mys(n) = factorial of n

2. The function always terminates with

mys (n) = 1+2+...+n

3. The function terminates for non negative n with mys (n) = factorial of n

4. The function for positive n with mys(n)= factorial of n










For what value of n would g(57,n) return 7?

def g (m,n):

res = 0

while m >= n :

res = res + 1

m = m - n

return (res)



Write a program to output the following

Hello

There


What is h(41)-h(40), given the definition of h below?

def h(n):
    s = 0
    for i in range(1,n+1):
        if n%i > 0:
           s = s+1
    return(s)

An integer number is said to be a perfect number if the sum of its factors, including 1 (but not the number itself), is equal to the number. For example, 6 is a perfect number, because 6 = 1

+ 2 + 3. Write a function perfect that determines whether parameter number is a perfect number. Use this function in a program that determines and prints all the perfect numbers between 1 and 1000. Print the factors of each perfect number to confirm that the number is indeed perfect.



Assume a and b are two (20, 20) numpy arrays. The L2-distance (defined above) between two equal dimension arrays can be calculated in python as follows:


def l2_dist(a, b):

    result = ((a - b) * (a - b)).sum()

    result = result ** 0.5

    return result


Which of the following expressions using this function will give an error?

l2_dist(np.reshape(a, (20 * 20)), np.reshape(b, (20 * 20, 1)))




Following is the program for performing all the operations on a table 'student' through a menu driven program.


Currently, this program will add 6 and 3 together, output the math problem and output the answer. Edit this code so that a random number is generated from 1 - 10 (inclusive) for the variables a and b. Also, instead of adding the two numbers together, the edited program should multiply them, and output the proper math problem and answer. Be sure to update every line of code to reflect the changes needed.


LATEST TUTORIALS
APPROVED BY CLIENTS