Question: How to write this functiom in python? def update_data(data_years: List[str], start_year: int, data_scores: list) -> None: update update_data so that each element contains the year
How to write this functiom in python?
def update_data(data_years: List[str], start_year: int, data_scores: list) -> None:
"""update update_data so that each element contains the year as a string, starting from start_year and decreasing by one for each subsequent element until data_years has the same length as data_scores. Also, update data_scores so that all non-empty string values are float values, and all empty string values are LOSING_SCORES."""
>>> years = [] >>> scores = ['', '72.3', '', '69.5', '', '70.0', '', '70.3', ''] >>> update_data(years, 2013, scores) >>> years ['2013', '2012', '2011', '2010', '2009', '2008', '2007', '2006', '2005'] >>> scores [-1.0, 72.3, -1.0, 69.5, -1.0, 70.0, -1.0, 70.3, -1.0]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
