- Joined
- Sep 16, 2009

- Messages
- 1

- Reaction score
- 0

I used the math.floor function to round the number down to get degrees, and I feel that subtracting the result of this function from the original decimal degree input would be easiest to get just the decimal, but I am getting a syntax error "'float' object is unsubscriptable." I think it has to do with the data type and I have been searching for a couple of hours through the Python documentation and haven't found anything helpful. Any help or suggestions are appreciated.

Here is what I have so far:

# Import System and Math Modules

import sys, math

# Input Argument (in Decimal Degrees, ex: 42.5678)

decdegrees = float(sys.argv[1])

# Conversion

degrees = math.floor(decdegrees) # to return whole 42

minutes = (decdegrees - degrees) * 60

#seconds =

# Display Result

#print degrees " " minutes " " seconds " "

print degrees " " minutes