Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Town:
- def __init__(self, name):
- self.name = name
- self.latitude = None
- self.longitude = None
- def set_latitude(self, latitude):
- self.latitude = latitude.replace('\\', '')
- def set_longitude(self, longitude):
- self.longitude = longitude.replace('\\', '')
- return longitude
- def __repr__(self):
- result = ''
- result += f"Town: {self.name} | Latitude: {self.latitude} | Longitude: {self.longitude}"
- return result
- town = Town("Sofia")
- town.set_latitude("42° 41\' 51.04\" N")
- town.set_longitude("23° 19\' 26.94\" E")
- print(town)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement