List comprehension Syntax [expression for item in iterable] Example… List comprehensionSyntax[expression for item in iterable]Example>>> [i for i in range(5)][0, 1, 2, 3, 4]SyntaxWe can also add a if condition. Where the values that satisfy the condition will be appended to the list.[expression for item in iterable if condition == True]Example>>> [i for i in range(5) if i%2 == 0][0, 2, 4]Compared to using a for loopBased on a list of mandarins, we want a list that contains the letter “m”. Using a for loop would look like this:mandarins = [“sumo citrus”, “afourer”, “imperial”, “delite”, “phoenix”, “amoertte”, “daisy”, “honey murcott”]new_list = []for mandarin_type in mandarins: if “m” in mandarin_type: new_list.append(mandarin_type)With list comprehension this can be done with one line of code:mandarins = [“sumo citrus”, “afourer”, “imperial”, “delite”, “phoenix”, “amoertte”, “daisy”, “honey murcott”]new_list = [mandarin_type for mandarin_type in mandarins if “m” in mandarin_type]TaskWrite the following functions:list_generation(number: int) -> List[int] that takes a number and returns a list that starts at 0 and ending but not including the given number.big_dogs(dogs: List[Tuple[str, float]], weight_threshold: int) -> List[str] that takes a list dogs containing Tuples of breeds and weight ((str, float)) and returns a list of dogs breeds that are above a certain weight threshold. Making use of list comprehension.(Note: the return list should only contain the breed of the dogs.)Computer ScienceEngineering & TechnologyPython Programming

Order your essay today and save 20% with the discount code ESSAYHELP