Question
Help with python function. (using unit testing) NO LOOP ****Note: cannot have a function that is built in or string manipulation 1) The first function
Help with python function. (using unit testing) NO LOOP
****Note: cannot have a function that is built in or string manipulation
1) The first function is having a parameter of base eight that takes four digit number. The number that will return can be equivalent to base ten or in decimal. The answer is an integer (whole number).
Number is 3562 (parameter is four digits and positive!)
1*8**3 + 1*8**2 + 1*8**1 + 1*8**0
(585)
Must add and multiply digits, then create and return the resulting number in decimal
2) The second function will take a two digit number and will have a parameter in base 10 or decimal. There will be a three digit 8 number that will return, the number is equivalent, it may begin with a zero and it will be a maximum of three digits. To get the digit of the most significant position you must use floor division when converting to find how many times 8**2 will go into the parameter. Then use modulus to find the other positions (8**1 and 8**0). Then put together each singular digit using an f string.
The decimal number 71 is equal to 1*8**2 + 6*8**1 + 7*8**0
two digit number returned and positive
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started