Codecademy Forums

FAQ: Taking a Vacation - Getting There

This community-built FAQ covers the “Getting There” exercise from the lesson “Taking a Vacation”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn Python

FAQs on the exercise Getting There

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

This might be a dumb question, but when I did my code, I followed the example on the left, and made my code:
if city == “Charlotte”:
return “183”
and so on for all the cities

When I saw the correct answer, it said
if city == “Charlotte”:
return 183

without the quotation marks in the return line.
In the example given for the lesson, they provided quotation marks for the return line, but when it was time for me to do it, they didn’t accept quotations and when they showed me the solution, there was none.

Is this because if it’s numbers in the return line, they don’t require quotations? I’m wondering why the solution doesn’t follow the example provided, or maybe I missed an explanation somewhere.

@chelliepaige I think I figured it out.

The example they gave is returning a string.

The exercise just wants you to return the number not as a string, so it does not need quotation marks.

Why when in the instructions it states " 1. The example above defines the function fruit_color that accepts a string as the argument fruit ." why is fruit defined as an argument and not a parameter?

def plane_ride_cost(city):
if city == “Charlotte”:
return 183
elif city == “Tampa”:
return 220
elif city == “Pittsburgh”:
return 222
elif city == “Los Angeles”:
return 475
still im getting erron check line 3
File “python”, line 3
** return 183**
** ^**
IndentationError: expected an indented block

i don’t know why.
please send me the clue

it means it wants u to have space there for “return” line. like this:

if city == “Charlotte”:
    return 183
elif city == “Tampa”:
    return 220
def hotel_cost(nights):
  return 140 * nights
  
def plane_ride_cost(city):
	if city == "Charlotte":
  	return 183
  elif city == "tampa":
  	return 220
  elif city == "pittsburgh":
  	return 222
  elif city == "los angeles":
  	return 475 

https://www.codecademy.com/courses/learn-python/lessons/taking-a-vacation/exercises/getting-there?action=resume_content_item
File “python”, line 6
return 183
^
IndentationError: unindent does not match any outer indentation level

guys, can you please let me know what is the error here?

I don’t have an else statement in my code and I noticed that the sample solution doesn’t either.
So what does this function return when the city doesn’t match any of the city names in the control structure? For example, what if I did plane_ride_cost("New York")?

Also, can we only call a function after we have defined the function? Or can I call a fucntion and then define it afterwards.