Created
          March 18, 2019 20:42 
        
      - 
      
 - 
        
Save berinhard/9eb69f44897f634193b612ef08976cf5 to your computer and use it in GitHub Desktop.  
    Exemplo 002 pythônico
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class Posicao(): | |
| def __init__(self, lat, lng): | |
| self.lat, self.lng = lat, lng | |
| @property | |
| def lat(self): | |
| return self._lat | |
| @lat.setter | |
| def lat(self, value): | |
| if not -90 <= value <= 90: | |
| raise ValueError("Latitude inválida") | |
| self._lat = value | |
| @property | |
| def lng(self): | |
| return self._lng | |
| @lng.setter | |
| def lng(self, value): | |
| if not -180 <= value <= 180: | |
| raise ValueError("Longitude inválida") | |
| self._lng = value | |
| def distancia(pos_1, pos_2): | |
| #### implementação do cálculo de distância | |
| def direcao(pos_1, pos_2): | |
| #### implementação do cálculo de direção | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment