I am just beginning in a class called Geocomputing, and I have no background experience in programming.
Here is the problem:
Write a Python script that asks the user to input the latitude and longitude of a location. After the user has entered the information, the script should display one of the following messages to describe the latitude entered:
Your program should display | If the latitude entered |
---|---|
That location is on the equator. | Is 0 |
That location is north of the equator | Is between 0 and 90 |
That location is south of the equator | Is between -90 and 0 |
That location does not have a valid latitude! | Is greater than 90 or less than -90 |
and one of the following messages to describe the longitude entered:
Your program should display | If the longitude entered |
---|---|
That location is on the prime meridian. | Is 0 |
That location is east of the prime meridian. | Is between 0 and 180 |
That location is west of the prime meridian | Is between -180 and 0 |
That location does not have a valid longitude! | Is greater than 180 or less than -180 |
If the user enters something other than a number, give them an error message and restart the program. Save your script as latlon.py.
My issue is that I am able to write a block of code for latitude and longitude each and am able to get the proper output phrase to come out, but when I try adding the sections of code where the program is checking to make sure that the input is valid I end up running into errors. It may just be that I don't quite know how to format and use the indentations yet, but I could really use some help on this one.
Hey, there are two functions with try and catch blocks that show an error if input is not an integer. After that the main function starts. Hope this helps.
Output :
Get Answers For Free
Most questions answered within 1 hours.