From the course: Python Code Challenges for Data Analysis

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Solution: Sort by runtime

Solution: Sort by runtime

- [Instructor] Let's go ahead and check out our test code section. And you can see, we've got an error about, with the sort by runtime, got an unexpected keyword argument shortest. And that's because this corresponds to the first test where we're passing shortest and longest. And if you look at the function definition, we've just got movies and we don't have shortest and longest. So let's go ahead and change that. Now, I want to ensure that everything after movies is going to be a keyword argument. So I can do that by forcing that by doing a asterisk and then shortest. And let's give it a default value, so the shortest sensible value for a movie is going to be zero. And I don't know what the longest length of any of the movies here are, so I'm just going to go ahead and specify 10,000 minutes. Let's see if this fixes this error. And you can see that we've now got these three sections, which correspond to these three test cases. Now, let's take a look at the format of our data. So for…

Contents