May-02-2020, 01:00 PM
dms holds string. Hence dms[0] gives first char which is expected behaviour.
Use split() as here to convert input to list
Use split() as here to convert input to list
>>> dms = input('DR_Lat (deg,min,sec,N/S/E/W) = ') DR_Lat (deg,min,sec,N/S/E/W) = 54,20,20 >>> dms '54,20,20' >>> type(dms) <class 'str'> >>> dms[0] '5' >>> dmsLst = input('DR_Lat (deg,min,sec,N/S/E/W) = ').split(",") DR_Lat (deg,min,sec,N/S/E/W) = 54,20,20 >>> type(dmsLst) <class 'list'> >>> dmsLst[0] '54'