Do Exercise 6.4 from your textbook using recursion and the is_divisible function from Section 6.4. Your program may assume that both arguments to is_power are positive integers. Note that the only positive integer that is a power of "1" is "1" itself.
After writing your is_power function, include the following test cases in your script to exercise the function and print the results:
print("is_power(10, 2) returns: ", is_power(10, 2))
print("is_power(27, 3) returns: ", is_power(27, 3))
print("is_power(1, 1) returns: ", is_power(1, 1))
print("is_power(10, 1) returns: ", is_power(10, 1))
print("is_power(3, 3) returns: ", is_power(3, 3))
You should submit a script file and a plain text output file (.txt) that contains the test output. Multiple file uploads are permitted. Don’t forget to include descriptive comments in your Python code.
Your submission will be assessed using the following Aspects.
Does the submission include the is_divisible function from Section 6.4 of the textbook?
Does the submission implement an is_power function that takes two arguments?
Does the is_power function call is_divisible?
Does the is_power function call itself recursively?
Does the is_power function include code for the base case of the two arguments being equal?
Does the is_power function include code for the base case of the second argument being "1"?
Does the submission include the correct output for the five test cases?
Answers
Answer:
bhai Apne man baap se pooch shayad seva Teri kat ke chipka de
Answer:
please follow me
- please mark me brain list
Explanation:
6. A train travels some distance with a speed of 30 km/h and returns with a speed of 45 km/h . Calculate the average speed of the train .
7. A train 100 m long moving on a straight level track passes a pole in 5 s . Find (a) the speed of the train (b) the time it will take in to cross a bridge 500 m long .
8. A car travels along a straight lion for first half time with speed 40 km/h and the second half time with speed 60 km/h. find the average speed of the car.
9. A body starts rolling over a horizontal surface with an initial velocity of 0.5 m/s² . Due to friction , its velocity decreases at the rate of 0.05 m/s² . How much time will it take for the body to stop ?
10. A car travelling at 36 km/h speed upto 72 km/h in 5 second. what is it acceleration ? If the same car stops in 20 second , what is the retardation ?