{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### IMDB movie picker" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this exercise we will go back to the IMDB data. Feel free to reuse parts of your code from previous days!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create a movie picker function. The function will pick the first movie that fits the user's requirements\n", "and print its title. The user can choose to pick a movie based on one or more of the four requirements `year`, `genre`, `minimal rating` or `maximal rating`.\n", "\n", "`>>> pick_movie(genre=\"Drama\")`\n", "\n", "`The Paths of Glory`\n", "\n", "`>>> pick_movie(year=2001)`\n", "\n", "`Donnie Darko`\n", "\n", "`>>> pick_movie(rating_min=8)`\n", "\n", "`Paths of Glory`\n", "\n", "`>>> pick_movie(year=2009, genre=\"Mystery\")`\n", "\n", "`The Secret in Their Eyes`\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Reuse parts of your old code to create a loop that goes through the imdb file and splits each row into values.\n", "\n", "Your function must allow keyword arguments. \n", "The function definition could look like this:\n", "\n", "```py\n", "def pick_movie(year=None, genre=None, min_rating=None, max_rating=None):\n", "```" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" } }, "nbformat": 4, "nbformat_minor": 2 }