Question: IN PYTHON Problem 1 Must meet 1 & 2 for thumbs up. 1. Use Tuples data type 2. Comment out lines of code Latitude and
IN PYTHON
Problem 1
Must meet 1 & 2 for thumbs up.
1. Use Tuples data type
2. Comment out lines of code
Latitude and longitude can be expressed in either degrees/minutes/seconds (DMS) or decimal format. For example, Google Maps lists Georgia Southern University as located at 32 25' 16.1394" (latitude) and -81 47' 11.6592" (longitude).
Formula for DMS TO decimal conversion formula is, Decimal Degrees = degrees + (minutes/60) + (seconds/3600)
Write the reverse of the dms_to_decimal function and name it dd_to_dms. Have it convert decimal locations to DMS format. The dms_to_decimal function's return value becomes the dd_to_dms function's parameter and vice versa
input: Enter latitude in decimal format: 32.42114983333333
input: Enter longitude in decimal format: -80.2134800000001
output: ((32, 25, 16.13939999999161), (-81, 47, 11.471999999627087))
Example of similar with asking for mins and seconds which is not needed for the above.
lat = input('Enter degree, minute, seconds') # get three values for latitude lat_fields = lat.split(',') degree1 = int(lat_fields[0]) min1 = int(lat_fields[1]) sec1 = float(lat_fields[2]) #save as three fields long = input('Enter degree, minute, seconds') long_fields = long.split(',') degree2 = int(long_fields[0]) min2 = int(long_fields[1]) sec2 = float(long_fields[2]) loc = (lat, long) #create tuple combining latitude and longitude def dms_to_dec(loc): #create function to convert the dms to decimal final1 = degree1 + (min1/60) + (sec1/3600) final2 = degree2 + (min2/60) + (sec2/3600) return final1, final2 values = dms_to_dec(loc) #call the function by passing the latitude and longitude as parameters print(values) Enter degree, minute, seconds32,25,16.1394 Enter degree, minute, seconds-81,47,11.6592 (32.42114983333333, -80.21342800000001)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
