Menu

Please Solve 4a 4b Thanks 2 Q43859500

Please solve both 4a and 4b, thanks!

2 <= b <= 10

Base cannot be greater than 10 and less than 2.
4a. Define a Python function called digits that, on input a positive integer N and a positive integer b, 34 returns a tuple c

4a. Define a Python function called digits that, on input a positive integer N and a positive integer b, 34 returns a tuple consisting of the digits of N written in base 6, from left to right. For example, if N = 327 and b = 10, you should return (3,2,7). In [ ]: 4b. In terms of your answer to part a, write a list comprehension in terms of the variables b and N to find 36 all integers from 1 to N (inclusive) which are multiples of the sum of their base-b digits. Show transcribed image text 4a. Define a Python function called digits that, on input a positive integer N and a positive integer b, 34 returns a tuple consisting of the digits of N written in base 6, from left to right. For example, if N = 327 and b = 10, you should return (3,2,7). In [ ]: 4b. In terms of your answer to part a, write a list comprehension in terms of the variables b and N to find 36 all integers from 1 to N (inclusive) which are multiples of the sum of their base-b digits.

Expert Answer


Answer to Please solve both 4a and 4b, thanks! 2 …

OR