Need Help!

EOF While Scanning Tripple-Quoted String Literal
I am tring to write a program which can help me to fid dthe distance of two points
and so far my detail is as follow:
Bx=input(“enterBasexnumber”)
print(Bx)
By=input(“enterBaseynumber”)
print(By)
Lx=input(“enterLocationxnumber”)
print(Lx)
Ly=input(“enterLocationynumber”)
print(Ly)

Xquare=(Lx-Bx)**2
Ysquare=(Ly-By)**2
import math
print"math.sqrt(Xquare+Ysquare):"

and the error appears at the bottom line, but to my knowledge I don’t need the riple quotes anywhere!
plus I am totally new to this python and all the programing thing so please help!

A few things to point out. First, whenever you post code you should format it as code. This is especially helpful with Python since indentation is extremely important. To format code, my preferred method is to type 3 back tics, skip a line, type 3 more back tics then paste your code on the line between them:

```
Paste code here
```

Second, the syntax of your print statement at the end is incorrect. You aren’t printing any text. You’re printing the result of the math.sqrt() function, so no quotation marks. Also whatever you want printed needs to be included inside of parenthesis as the print() function’s parameter like so:

print (math.sqrt(Xquare+Ysquare))

One last thing, user input will always be of data type string. You can’t perform any mathematical calculations with strings. They have to be converted to numbers of some type. Integers would probably suffice for your code, or you could use floats. You can accomplish this with either the int() or float() function.
Hope this helps! Good luck && happy coding!

2 Likes

Dear Tod Thank you so much for your reply, I was wondering is anyone gonna say anything to my post, according to your statements I’ve made the change as below but the error still exist at the bottom line below is the program so far if you would kindly help
me to understand what sill goes wrong?


Bx=int(input("enterBasexnumber"))

print(Bx)

By=int(input("enterBaseynumber"))

print(By)

Lx=int(input("enterLocationxnumber"))

print(Lx)

Ly=int(input("enterLocationynumber"))

print(Ly)

Xquare=(Lx-Bx)**2

Ysquare=(Ly-By)**2

import math*

print (math.sqrt(Xquare+Ysquare))

now the error of EoF while scanning triple quoted string literal appear at the bottom 3 back tics line

Please help, and thatnk you in advance:)

William C.

The asterisk needs to go. After removing it, I can run your code just fine. Are you running this on the Codecademy site in a lesson, or in another environment? Either way, remove the asterisk, and give it another try. Good luck!

Dear Tod thanks again for your reply, first to answer your question about the platform I run the programing on, it’s a book I bought about python and from it I downloaded a software called anaconda which is a freeware and I use the implantated platform called
spyder to progrm and just now I found out the program I typed has three quotation “”" at the very beginning of the page with #&dates and &author following it so I realized that the quotation was to act as to surround the side-note of # which the program won’t
read so I added another set of three quotation at the end of the side notes then the error of EOL is gone finally it’s not just the asterisk because after I remove it before I added the set of the three quotation to close the side notes the error still exist
at the same bottom line, and I have another question if I may because I am so interested in learning python afterall it’s my first programing language, in the last message you’ve mentioned the back tic(`) although I’ve went through the book I bought and searched
the internet but I still couldn’t find its function in python if you would kindly to explain more on that? thank you again so much for your help!!!

William C.

It is under the tilde ~, upper left on US keyboard layout. I didn’t know this until just now. I would have sworn that it was absent!

The best way to find it here on the forum is to use the </> icon that is in the middle of the menu bar at the top of the text box when you are typing in it. Clicking on that icon sets up two sets of three of those back-tics; between the sets is a space in which you can type or paste your code and have its formatting preserved.

capture

1 Like

When I mentioned using the back tic, it was purely for use in posting code in this forum. I’m not a Python guru, but I don’t think it has particular functionality in Python 3. Putting your code between back tics preserves white space & indentation, so readers can then paste your code into their preferred environment to run it, and help find errors. Following @patrickd314’s suggestion is an easy way to get the back tics in place. Just click on </> first before pasting your code.