FAQ: Introduction to Functions - Review

small(maybe) problem, it says that i have to upgrade my plan to pro in order to continue, last i checked, i was already on pro. what has happened?

I’m not sure. We cannot answer subscription/billing questions on the forums. For that, you’d have to contact CS and open a support ticket.

CS? what does that mean? you might have to tell me which buttons to push as i don’t think i’ve done that before

Sorry. Customer service/support. Under the Help section on the main page of this site. Codecademy Help>My Account should do it.

Hello, this is driving me insane.

Why isn’t this working?

def trip_planner_welcome(name): print("Welcome to tripplanner v1.0", name) trip_planner_welcome("Paul") def estimated_time_rounded(estimated_time): rounded_time = round(estimated_time) return rounded_time estimate = estimated_time_rounded(2.5) def destination_setup(origin, destination, estimated_time, mode_of_transport = "Car"): print("Your trip starts off in " + origin) print("And you are traveling to " + destination) print("You will be traveling by " + mode_of_transport) print("It will take approximately " + str(estimate) + " hours") destination_setup("Tampa", "Boston", 48)

This is the last step, can someone please give me a code I can just copy and paste so I can move on already? This exercise actually doesn’t allow you to move on, nor does it provide you with a step by step breakdown and it’s beyond frustrating!!!

1 Like

We don’t give out answers here. I’m sorry.

That said, double check your function estimated_time_rounded…and the value of estimate.

It literally runs inside the code! If you run it, it says it works!

Codecademy is simply not letting me proceed, I’m going nuts wasting precious time over this…

But it doesn’t take 2 hours to travel from Tampa to Boston by car…

The estimated time you supplied was 48.

My friend showed me what was wrong.

I should’ve used the variable estimate instead of 48.

WRONG (Below)

def trip_planner_welcome(name): print("Welcome to tripplanner v1.0", name) trip_planner_welcome("Paul") def estimated_time_rounded(estimated_time): rounded_time = round(estimated_time) return rounded_time estimate = estimated_time_rounded(2.5) def destination_setup(origin, destination, estimated_time, mode_of_transport = "Car"): print("Your trip starts off in " + origin) print("And you are traveling to " + destination) print("You will be traveling by " + mode_of_transport) print("It will take approximately " + str(estimate) + " hours") destination_setup("Tampa", "Boston", 48)

RIGHT (below)

def trip_planner_welcome(name): print("Welcome to tripplanner v1.0", name) trip_planner_welcome("Paul") def estimated_time_rounded(estimated_time): rounded_time = round(estimated_time) return rounded_time estimate = estimated_time_rounded(2.5) def destination_setup(origin, destination, estimated_time, mode_of_transport = "Car"): print("Your trip starts off in " + origin) print("And you are traveling to " + destination) print("You will be traveling by " + mode_of_transport) print("It will take approximately " + str(estimate) + " hours") destination_setup("Tampa", "Boston", estimate)

But, you hardcoded a time in that function. Your function should take any argument for estimated time.
And, again, it takes longer that 2 hours to drive ~1300 miles. More like 21 hours.

hi
Did you call destination_setup() with all the correct arguments?

i’ m getting error again and again my code is working well

this is my code
def trip_planner_welcome(name):
print(“Welcome to tripplanner v1.0”, name)
trip_planner_welcome(“Harpreet”)

def estimated_time_rounded(estimated_time):
rounded_time = round(estimated_time)
return rounded_time

estimate = estimated_time_rounded(1.6)
print(estimate)

def destination_setup(origin, destination, estimate, mode_of_transport=“Car”):
print("Your trip starts off in " + str(origin))
print("And you are traveling to " + str(destination))
print("You will be traveling by " + mode_of_transport)
print(“It will take approximately " + str (estimate) + " hours”)

destination_setup(origin = ‘India’, destination = ‘Canada’, estimated = 24.3, mode_of_transport =‘Airoplane’)

Everyone i keep on getting a
Did you use print() with the string "Your trip starts off in " concatenated with the parameter origin ? message for step 4.
Please help!

ef trip_planner_welcome(name): print("Welcome to tripplanner v1.0" + name) trip_planner_welcome("Adam") def estimated_time_rounded(estimated_time): rounded_time = round(estimated_time) return rounded_time estimated_time_rounded(5.6) estimate = estimated_time_rounded(5.6) def destination_setup(origin, destination, estimated_time, mode_of_transport = "Car"): print("Your trip stars off in " + origin) print("And you will be travelling to " + destination) print("You will be travelling by " + mode_of_transport) print("It will take approximately " + str(estimated_time) + " hours") destination_setup("London", "Wales", estimate, "Car")

You wrote "stars" instead of "starts".

Make sure all your print statements match the strings specified in the instructions EXACTLY including uppercase/lowercase, punctuation, spelling etc.

Also, do the instructions specify "travelling" or "traveling"?

2 Likes

thank you so much!
I was struggling on the code and i was wondering why i couldnt move on from it.

1 Like

Hi, I am struggling to complete step 4. I keep getting the same error :

Did you use print() with the string "It will take approximately ____ hours " concatenated with the parameter estimated_time in the blank?

However I have done this and tried different versions with spaces after hours and before etc. but I cannot solve it :frowning:
This is my code below:

def destination_setup(origin, destination, estimated_time, mode_of_transport="Car"): print("Your trip starts off in " + origin) print("And you are traveling to " + destination) print("You will be traveling by " + mode_of_transport) print("It will take approximately " + str(estimated_time) + " hours ")

Thanks!

Why do you have trailing space(s) in one of your print statements? Your output should match the strings specified in the instructions EXACTLY.

// You wrote:
print("It will take approximately " + str(estimated_time) + " hours  ")

// It should be:
print("It will take approximately " + str(estimated_time) + " hours")

Thanks for your response!

I have tried with and without trailing spaces around the string in many different versions. I have also tried copying and pasting the code directly but still get the error. So I believe I have copied the instructions exactly but am still encountering the error. :face_with_raised_eyebrow:

Thanks!

At the bottom of the exercise, there should be a “Copy to Clipboard” button.

After clicking the button, post all of your code. You can either share it as a Codebyte OR paste it in the forums with proper formatting using the </> button ([How to] Format code in posts)

It might help narrow it down to whether there is a mistake in the code or a bug in the exercise.

1 Like

Definitely the preferred method. Just saying.

Hi all, I am having the same issue as rebdawg above.

I have double, triple and quadruple checked my code but I can’t find any errors. Any help would be much appreciated.

Code and output below:

def trip_planner_welcome(name):
  print("Welcome to tripplanner v1.0 " + name)

trip_planner_welcome("Elliot")

def estimated_time_rounded(estimated_time):
    rounded_time = round(estimated_time, 0)
    return rounded_time

estimate = estimated_time_rounded(12.2)

def destination_setup(origin, destination, estimated_time, mode_of_transport = "Car"):
  print("Your trip starts off in " + origin)
  print("And you are traveling to " + destination)
  print("You will be traveling by " + mode_of_transport)
  print("It will take approximately " + str(estimated_time) + " hours")

destination_setup("Bangkok", "Singapore", estimate, "Boat")

Output:
Welcome to tripplanner v1.0 Elliot
Your trip starts off in Bangkok
And you are traveling to Singapore
You will be traveling by Boat
It will take approximately 12.0 hours