Question
Language: Python Program used: PyCharm Interpreter: 3.6.1 at ~/anaconda/bin/python ---------- ---------- Starter code: quests = [ [Destroy the Rats in the Farmer's Basement, Westhaven Farms,
Language: Python
Program used: PyCharm
Interpreter: 3.6.1 at ~/anaconda/bin/python
----------
----------
Starter code:
quests = [ ["Destroy the Rats in the Farmer's Basement", "Westhaven Farms", [1, 5], [1.0, 0.2]], ["Infiltrate the Bandit's Lair", "The Badlands", [2, 4], [40.0, 1]], ["Defeat Goliad", "Candy Kingdom", [20, 25], [10.0, 1.5]], ["Locate the Lich's Lair", "Costal Wasteland", [35, 40], [100.0, 10.0]], ["Atone for Shoko's Sins", "Finn's Treehouse", [15, 17], [0.0, 0.0]], ["Make an Amazing Sandwich", "Finn's Treehouse", [7, 11], [0.0, 0.0]], ["Find the Ice King's Wizard Eye", "Ice Kingdom", [9, 15], [25.0, 2.0]], ["Get some pickles from Prismo", "Prismo's Home", [27, 31], [42000000.0, 0.1]], ["Rescue Wildberry Princess from the Ice King", "Ice Kingdom", [3, 11], [25.0, 2.0]], ["Win Wizard Battle", "Wizard Battle Arena", [13, 18], [90.0, 7.0]], ["Eat Marceline's Fries", "Marceline's House", [3, 6], [16.0, 2.5]], ["Rescue Marceline from the Nightosphere", "The Nightosphere", [21, 27], [200.0, 1.5]], ["Discover Peppermint Butler's Secrets", "Candy Kingdom", [35, 40], [10.0, 1.5]], ["Defeat the Ice King's Penguin Army", "Candy Kingdom", [27, 29], [10.0, 1.5]], ["Discover the Ice King's Secret Past", "The Past", [10, 35], [0.5, 21.0]], ["Watch what Beemo Does When He Is Alone", "Finn's Treehouse", [1, 50], [0.0, 0.0]] ]
# Code parts (a) through (g) of question 4 here.
Question 4 (10 points): Purpose: To practice working with lists of lists Degree of Difficulty: Moderate Background To demonstrate the value of lists of lists, we'll be writing Python code to manipulate quest log information, imagining that this information pertains to a video game quest log which displays the list of uncompleted quests available to your in-game character In a4q4-starter.py you are given a definition of a list of quests. Each quest is a list consisting of (in order): . The name of the quest (a string) . The location in the fantasy game world where the quest takes place (a string) A list consisting of two items: The suggested minimum character level one should have achieved before doing this quest (an integer) The maximum character level at which completing the quest grants rewards (an integer) Another list containing two items: The distance in kilometers from your current location to the world location where the quest takes place (a float) The time in hours it takes to travel from your current location to the world location where the quest takes place (a float). Note that more distant quests do not necessarily take longer to travel to - different modes of transportation are available between different locations! The above format describes a single quest. A list of quests is therefore a list of Lists. As well each quest has a couple of lists inside of it (see above). That's two levels of nesting. not just one! What to Do Complete this program in steps: (a) Write a function called create quest that takes as arguments all of the information about one quest . The quest name (string) . The quest location (string) . The quest's minimum recommended level (integer) . The quest's maximum character level for receiving quest rewards (integer) . The distance to the quest location (float) . The time needed to travel to the quest location (float) and constructs a quest, that is, a list with the format given above, and returns that list. Each of the arguments is to be provided individually, thus the function should have six parameters. (b) Call your function three times to create three new quests. You should make up your own quest infor- mation - there's no reason why two students should submit the same new quests. (c) Add the returned quests from your three function calls in part (b) to the existing quests list. (d) Write a function named travel time that takes a quest name and a list of quests i.e. a list in the same format as the pre-defined quests) as arguments. Name the function's parameters query_quest and current quests, respectively. The function must look up the time required to journey to query_questStep 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