Log in from a computer to take this course

You'll need to log in from a computer to start Learn Python 2. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store
Learn

You’re going to need to take a plane ride to get to your location.

def fruit_color(fruit): if fruit == "apple": return "red" elif fruit == "banana": return "yellow" elif fruit == "pear": return "green"
  1. The example above defines the function fruit_color that accepts a string as the argument fruit.
  2. The function returns a string if it knows the color of that fruit.

Instructions

1.

Below your existing code, define a function called plane_ride_cost that takes a string, city, as input.

The function should return a different price depending on the location, similar to the code example above. Below are the valid destinations and their corresponding round-trip prices.

  • "Charlotte": 183
  • "Tampa": 220
  • "Pittsburgh": 222
  • "Los Angeles": 475

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?