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: Find the most nominations - Python Tutorial
From the course: Python Code Challenges for Data Analysis
Solution: Find the most nominations
- [Instructor] Let's head over to our test code. And so, this single test corresponds to the section over here. Now, if we take a look at the function movie most nominations. And let's take a look and get a better understanding of our data. So, for movie in the list movies, and I want to go ahead and just print the awards. And you can see that this is what the awards field looks like. Now, let's think a little bit about what our solution will look like. So, we wanted to get the maximum value for the nominations. And so, it's probably going to look something like this. We wanted to use the max inbuilt function where we're going to be passing in our movies, and we want to use the Lambda function, so Lambda movie in the (movie['Awards']) . And if I was to go ahead and just print this, and let me just comment out the top two lines. Now, you'll remember that the actual output we need is the movie title. And so, our solution will look something like this, where we return the max, and then…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.