Answered step by step
Verified Expert Solution
Question
1 Approved Answer
To be done in python 3.0 Question 1 (8 points): Purpose: To practice recursion with a simple example. Degree of Difficulty: Easy The evil Team
To be done in python 3.0
Question 1 (8 points): Purpose: To practice recursion with a simple example. Degree of Difficulty: Easy The evil Team Rocket has invented an incredible new space-ship! The ship works as follows If the distance to the destination is greater than 1 meter, the ship will 'fold space" and jump toa position exactly half way to the destination. It takes exactly one minute to perform this process. .Any distance of 1 meter or less will take exactly one minute, using normal impulse rockets. For example, if the ship has to travel 10 meters, it will jump 5 meters after the first minute, 2.5 meters the second minute. 125 meters the 3rd minute, and O.625 meters the fourth minute. Finally, the remaining 0.625 meters takes one more minute. Thus the total time to travel 10 meters is 5 minutes. (That seems very slow, and it is for small distances, the true value of this method only reveals itself for large distances.) Write a recursive function called spaceTime ) that calculates the time needed for Team Rocket's new ship to travel a given distance (in meters). In the same file, write code that asks the user for a distance in meters (console input), and then calls your spaceTime) function to calculate the time required to travel the given distance Test your function out on all of the following examples: Distance from Team Rocket's base to the nearest Poke-Stop: 37 meters. Distance for a round-trip around the entire planet earth: 40075000 meters. Average distance between our earth and our sun: 149ell meters (about 150 million km). Approximate distance between the sun and the closest star: 4.0e16 meters (about 4 light-years). Size of the observable universe: 8.8e26 meters (about 93 Giga-light-years) Sample Run Here is an example execution of the required program. Team Rockot 's drive requires - 7 minutes to travel 37 meters to the nearest Poke -Stop - 27 ninutes to travel 40075000.0 meters for a round -trip around the earth 39 ninutes to travel 149000000000.0 meters from our earth to our sun -57 ninutes to travel 4e+16 meters from our sun to the nearest star -91 inutes to travel 8.8e+26 eters acros th@ observable universe WOW, IS TEAM ROCKET EVER BLASTING OFF AGAIN!! Your console output doesn't have to look exactly ike the above. Copy/paste your output for all of the examples above into a document called a7q1.output.txt for submissionStep 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