Question

In python, write a function that converts an input latitude or longitude value in degrees, minutes,...

In python, write a function that converts an input latitude or longitude value in degrees, minutes, and seconds (DMS; no decimals) into decimal degrees (DD). Directions:

  • The function should take a tuple containing three numbers representing degrees, minutes and seconds and returns the corresponding decimal degree equivalent.
  • You can assume if the degree value is negative all 3 fields are negative. Thus “-30 30 00” is -30.5 degrees, not -29.5 degrees.
  • Test your function with some known values before you continue.

Homework Answers

Answer #1

def DMStoDD(degree, minutes, seconds):
         
        dd = abs(degree) + abs(minutes)/60 + abs(seconds)/3600

        if degree > 0:
                return dd
        else:
                return -dd

print(DMStoDD(-30, 30, 00))
**************************************************

Thanks for your question. We try our best to help you with detailed answers, But in any case, if you need any modification or have a query/issue with respect to above answer, Please ask that in the comment section. We will surely try to address your query ASAP and resolve the issue.

Please consider providing a thumbs up to this question if it helps you. by Doing that, You will help other students, who are facing similar issue.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT