Location.py
class Location:
"""Class containing the data for each city"""
def __init__(self, code, name, country, continent, timezone, latitude, longitude, population, region):
self.code = code
self.name = name
self.country = country
self.continent = continent
self.timezone = timezone
self.latitude = latitude
self.longitude = longitude
self.population = population
self.region = region
def print(self):
print("Code: " + self.code)
print("Name: " + self.name)
print("Country: " + self.country)
print("Continent: " + self.continent)
print("Timezone: " + str(self.timezone))
print("Latitude: " + str(self.latitude))
print("Longitude: " + str(self.longitude))
print("Population: " + str(self.population))
print("Region: " + str(self.region))
def brief_print(self):
print(self.code + " (" + self.name + ")")
def get_info(self):
ret_str = "Code: " + self.code + "\n"
ret_str += "Name: " + self.name + "\n"
ret_str += "Country: " + self.country + "\n"
ret_str += "Continent: " + self.continent + "\n"
ret_str += "Timezone: " + str(self.timezone) + "\n"
ret_str += "Latitude: " + str(self.latitude) + "\n"
ret_str += "Longitude: " + str(self.longitude) + "\n"
ret_str += "Population: " + str(self.population) + "\n"
ret_str += "Region: " + str(self.region) + "\n"
return ret_str
def get_brief(self):
return self.code + " (" + self.name + ")" + "\n"
def get_name(self):
return self.name