Question: Can someone please help me with this PYTHON problem! please answer with code! the only parts that you need to change have # YOUR CODE

Can someone please help me with this PYTHON problem! please answer with code! the only parts that you need to change have # YOUR CODE HERE

The Super Digit

The "super digit" of a (base 10) number N is defined as follows:

if the number consists of a single digit, it is simply N

otherwise, it is the super digit of the sum of the digits of N

Examples:

the super digit of 7 is 7

the super digit of 42 is the super digit of 4+2=6, which is 6

the super digit of 9876 is the super digit of 9+8+7+6=30, which is the super digit of 3+0=3, which is 3

Implement the recursive function super_digit, which returns the super digit of its argument.

In [ ]:

def super_digit(n): 
 # YOUR CODE HERE 
 raise NotImplementedError() 

. . .

In [ ]:

# (5 points) 
 
from unittest import TestCase 
 
tc = TestCase() 
 
tc.assertEqual(super_digit(5), 5) 
tc.assertEqual(super_digit(30), 3) 
tc.assertEqual(super_digit(9876), 3) 
tc.assertEqual(super_digit(11111111111111), 5) 
tc.assertEqual(super_digit(12345678901234567890), 9) 

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!