{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png)\n", "\n", "# Unit 2 Lab: Control Flow\n", "\n", "## Overview\n", "Welcome to the second unit lab!\n", "\n", "Right now, you have a variable to hold a movie title, a variable to hold a movie's rating, and a print statement to show the user.\n", "\n", "Next, let's set up the functions and control flow to print out the values of our variables." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Movie Title\n", "\n", "This section will remain unchanged for this lab." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "movie_title = \"Back to the Future\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Movie Rating\n", "\n", "This section will remain unchanged for this lab." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "movie_rating = 8" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Print the Result\n", "\n", "Wrap the print statement with a function, `print_ratings`, which:\n", "\n", "- Takes two arguments:\n", " - `movie_list`, a list of movies (assume all string values)\n", " - The previously declared variable, `movie_rating`\n", "- Iterates through the list of movies and prints `The rating for is `.\n", " - Note that, because we have a single value of `move_rating`, the rating will be the same for all movies. That's okay for now." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Test Your `print_ratings` Function\n", "\n", "- Create a list of movies, `movie_list`, with the following values:\n", " - `\"Back to the Future\"`\n", " - `\"Blade\"`\n", " - `\"Spirited Away\"`\n", "- Call your function, `print_ratings`" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# A:" ] } ], "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.7.6" } }, "nbformat": 4, "nbformat_minor": 2 }