Question

PYTHON: Function name: function13 Function parameters: none Function behavior: Hard code the following data structure in...

PYTHON:

Function name: function13

Function parameters: none

Function behavior: Hard code the following data structure in the function.

data = {('Dogs', 1): ['Poodle', 'Lab','Shitzu'], ('Cake', 2): ['Sugar', 'Flour', 'Eggs'], ('Taco', 1): ['Beef', 'Steak', 'Chicken'], ('Colors', 1): ['Green','Yellow']}

We have a dictionary where the keys are tuples with a subject and the values are correlated in that subject.

Retrieve the names "steak" and "chicken" from the Taco key.

Function return: A list with the second two taco options (Steak and Chicken)

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def function13():
    data = {('Dogs', 1): ['Poodle', 'Lab', 'Shitzu'], ('Cake', 2): ['Sugar', 'Flour', 'Eggs'],
            ('Taco', 1): ['Beef', 'Steak', 'Chicken'], ('Colors', 1): ['Green', 'Yellow']}
    return data[('Taco', 1)][1:]


# Testing the function here. Remove the below line if it's not necessary.
print(function13())

Add a comment
Know the answer?
Add Answer to:
PYTHON: Function name: function13 Function parameters: none Function behavior: Hard code the following data structure in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Language: Python Topic: Dictionaries Function name: catch_flight Parameters: dictionary, tuple containing two strings Returns: dictionary Description:...

    Language: Python Topic: Dictionaries Function name: catch_flight Parameters: dictionary, tuple containing two strings Returns: dictionary Description: You’ve been stuck in NYC for around 8 months all by yourself because you haven’t been able to find a good time to fly home. You’re willing to go to any city but want to see how many flights to each location fit your budget. You’re given a dictionary that has city names (strings) as the keys and a list of prices (list) and...

  • class Livestock: def __init__(self,name,price_in,utilizations): self.name,self.price_in,self.utilizations = name,float(price_in),utilizations def __lt__(self,other): if self.utilizations is None: return True elif...

    class Livestock: def __init__(self,name,price_in,utilizations): self.name,self.price_in,self.utilizations = name,float(price_in),utilizations def __lt__(self,other): if self.utilizations is None: return True elif other.utilizations is None: return False else: return self.utilizations.count(';') < other.utilizations.count(';') def __eq__(self,other): return self.name == other.name def __repr__(self): return ("{}, {}".format(self.name,self.price_in)) raw_livestock_data = [ # name, price_in, utilizations ['Dog', '200.0', 'Draught,Hunting,Herding,Searching,Guarding.'], ['Goat', '1000.0', 'Dairy,Meat,Wool,Leather.'], ['Python', '10000.3', ''], ['Cattle', '2000.75', 'Meat,Dairy,Leather,Draught.'], ['Donkey', '3400.01', 'Draught,Meat,Dairy.'], ['Pig', '900.5', 'Meat,Leather.'], ['Llama', '5000.66', 'Draught,Meat,Wool.'], ['Deer', '920.32', 'Meat,Leather.'], ['Sheep', '1300.12', 'Wool,Dairy,Leather,Meat.'], ['Rabbit', '100.0', 'Meat,Fur.'], ['Camel', '1800.9', 'Meat,Dairy,Mount.'], ['Reindeer', '4000.55', 'Meat,Leather,Dairy,Draught.'],...

  • Help with Data Science python notebook, Question 1 Create a function called vowel_parse() that takes a...

    Help with Data Science python notebook, Question 1 Create a function called vowel_parse() that takes a single string as input. This string is the name of the input directory. It returns a dictionary. This dictionary has keys that are the names of the individual input files. The dictionary values are the number of words in that file that have adjacent vowels ('aa', 'ae', 'oo', 'ia', etc.). Use a regular expression to find these, do not hard code every possible combination...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT