Question: Code the following in Python 2.x. is_additive_prime() in primes.py : Additive primes [5 points] A positive integer is an additive prime if and only if

Code the following in Python 2.x. is_additive_prime() in primes.py: Additive primes [5 points] A positive integer is an additive prime if and only if it is prime and also the sum of its digits is also prime. For example, 11 is additive prime because it is prime and the sum of its digits 1 + 1 = 2 is also prime. Similarly, 23 is also additive prime since both 23 and 2 + 3 = 5 are prime. However, 19 is not because, even though it is prime itself, the sum of its digits 1 + 9 = 8 is not prime.

Write a function is_additive_prime() that takes a positive integer n as argument and returns True if n is an additive prime, and False otherwise.

For full credit, you have to reuse the sum_digits() function (pictured below) that you developed previously (by importing it from digits.py).

Please post a screenshot of your code so I can indent properly. Thanks!

Code the following in Python 2.x. is_additive_prime() in primes.py: Additive primes [5

bed malh.py ef sum digits(n): $python3 main.py total 0 while n>: total total + n % 10 n int (n /10 return total print (sum_digits(153)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!