Question: Python 3 Recursion Question 3 First, please use the google link to download the python starter file. Please copy and paste the link below into

Python 3 Recursion Question 3

First, please use the google link to download the python starter file.

Please copy and paste the link below into your browser, any viewer can download, not permission required. I have tested it. : )

https://drive.google.com/file/d/13WBn7e1jxSNxYrXoLJasfCa1-203V3az/view?usp=sharing

Python 3 Recursion Question 3 First, please use the google link todownload the python starter file. Please copy and paste the link belowinto your browser, any viewer can download, not permission required. I have

Purpose: To practice recursion on a more interesting problem. Degree of Difficulty: Tricky Pokemon are fantastic creatures that can evolve1 into other, usually stronger, creatures. In their secret laboratory, the evil Team Rocket has been trying to evolve Pokemon in terrifying new ways! Might it now be possible for a meek Magikarp to evolve all the way into the mighty Mewtwo? Your job is to to write a program that uses the power of recursion to find out. For this problem, you will be given a pokemon evolution book as a dictionary. The keys to this dictionary are pokemon names, and the value for each key is a list of pokemon that can be evolved into. The following is a sample of what this dictionary might look like book = " squirtle" "artortle"1 " wartortle" ["blastois e"1 " blastoise" [] "eevee L"flareon", "jolteon", "vaporeon"J In the example above, squirtle can (eventually) evolve into a blastoise by first evolving into a wartortle but never into an eevee. On the other hand, eevee can evolve into any one of flareon. jolteon or vaporeon Note that a pokemon that can no longer evolve might be in the book and associated with an empty list (like blastoise above) or might not be in the book at all. Either case is fine and your program needs to handle both cases correctly You are guaranteed, however, that the pokemon book will be structured such that a pokemon cannot 'devolve'. Thus, if pokemon A can, either directly or indirectly, evolve into pokemon B, then it will not be possible for B to evolve back into A Your task is to write a recursive function that will answer the question of whether a source pokemon can eventually evolve into a given target pokemon. Your function should have 3 parameters: the source, the target and the pokemon dictionary to use to check for possible evolutions. Your function should return True if it is possible for source to become the target and False otherwise This might sound a little difficult, but with the power of recursion, this is not a complicated problem. Your function should be no longer than 12 lines of code (not counting comments) and possibly less (ours is 8) If you find your solution is getting any longer than that, you are overthinking it! Note: For this question, you ARE allowed to use loops as part of your recursive function! You will likely use a loop to iterate over the lists that are in the evolution book. But your program should still use recursion to do the "real work" (in fact, this problem would be MUCH more difficult to solve without using recursion at al!!)

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!