Aug-11-2017, 02:44 PM
I am writing a simple converter to change a bearing to a polar coordinate. I'm not quite sure what I'm doing wrong, but the code below won't print the value of the conversion before moving to anotherPolar():
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
def polar(): direction = input ( "North or South?" ) angle = input ( "Angle from N Or S:" ) secondary = input ( "East or West?" ) polarangle = 0 if direction = = 'N' or direction = = 'North' : if secondary = = 'E' or secondary = = 'East' : polarangle = round ( 90 - float (angle), 4 ) return polarangle elif secondary = = 'W' or secondary = = 'West' : polarangle = round ( 90 + float (angle), 4 ) return polarangle elif direction = = 'S' or direction = = 'South' : if secondary = = 'E' or secondary = = 'East' : polarangle = round ( 270 + float (angle), 4 ) return polarangle elif secondary = = 'W' or secondary = = 'West' : polarangle = round ( 270 - float (angle), 4 ) return polarangle print (polarangle) polar() def anotherPolar(): again = input ( "Another?:" ) if again.lower() = = "y" or again.lower() = = "yes" : polar() anotherPolar() elif again.lower() = = "n" or again.lower() = = "no" : print ( "Goodbye" ) else : print ( "Invalid Entry" ) anotherPolar() anotherPolar() |