[SOLVED] CECS229 - Lab Programming Assignment #2

35.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (3 votes)

Write a function that will take in three inputs: base, exponent, and divisor. The output would be the product of the values of the modulus operations, such that when taking that as the modulus of the divisor, you will get the problem’s remainder.

 

Function name should be modulus_product. Do not print anything out. Comment out or delete your test cases.

 

Example: 

modulus_product(3,644,645) means 3644 mod 645. The function’s output should be 3560436, because 81, 396, 111 are the remainders used in finding the overall problem’s remainder, and 81 x 396 x 111 = 3560436. See the screenshot below for further details.

 

 

 

 

  1. (10 points)

Write a function, isPrime(L). input:

    L – list of numbers greater than 1.

output: numbers from that list that are prime

example: isPrime([2, 5, 8, 10, 13]) will return [2, 5, 13]

 

Do not print anything out. Comment out or delete your test cases.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.