Introduction to Functions: Why Functions? Slide 2

2021-12-02T08:00:00Z :slightly_smiling_face:

Hello everyone. I was wondering why I wasn’t able to print this line of code under the same comment 3 more times? The error message is below and I am not sure what it means. The title is where I got the issue from. Help please?

File “travel.py”, line 7
print(“The best route is by train and will take approximately 10 minutes.”) print(“Setting the Empire State Building as the starting point and Times Square as our destination.”)
^
SyntaxError: invalid syntax

Hi, welcome to the forums!

Can you provide the rest of your code? These lines are perfectly fine syntactically.

And also check this page on formatting [How to] Format code in posts

Sure. Here is the rest of my code. I was receiving the syntax error when I was reprinting the strings under the first comment rather than reprinting them seperately under each comment. I was just curious.

First user wants to travel between these two points!

print(“Setting the Empire State Building as the starting point and Times Square as our destination.”)

print(“Calculating the total distance between our points.”)

print(“The best route is by train and will take approximately 10 minutes.”)

Second user wants to travel between these two points!

print(“Setting the Empire State Building as the starting point and Times Square as our destination.”)

print(“Calculating the total distance between our points.”)

print(“The best route is by train and will take approximately 10 minutes.”)

Third user wants to travel between these two points!

print(“Setting the Empire State Building as the starting point and Times Square as our destination.”)

print(“Calculating the total distance between our points.”)

print(“The best route is by train and will take approximately 10 minutes.”)

Fourth user wants to travel between these two points!

print(“Setting the Empire State Building as the starting point and Times Square as our destination.”)

print(“Calculating the total distance between our points.”)

print(“The best route is by train and will take approximately 10 minutes.”)

Hi,
Yes, python is picky with indentations and line breaks.

#legal printing
print("legal")
#not legal
print("what a 
beautiful day it
is today!")

Hi, I am no texactly sure where the indendation is incorrect here?

Hi,

I’m not sure either because the text is not formatted ([How to] Format code in posts ).

I could only guess as to it, so I alluded to some of the more common errors.

You can even try creating a codebyte and paste there to replicate the problem. That may be the easiest solution at this point

print("this is my codebyte")

Here are some images to help guide you along:

  1. click on create codebyte
    Screen Shot 2021-12-05 at 5.38.57 PM

  2. specify the language and paste the code

  3. you have the codebyte!