primeiro commit com exercicios de Exercism realizados até esta data
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
class SpaceAge:
|
||||
def __init__(self, seconds: int):
|
||||
self.age_in_seconds: int = seconds
|
||||
self.precision: int = 2
|
||||
self.seconds_earth_years: int = int(365.25 * 24 * 60 * 60)
|
||||
|
||||
def on_earth(self) -> float:
|
||||
return round(
|
||||
self.age_in_seconds /
|
||||
(self.seconds_earth_years) / 1, self.precision
|
||||
)
|
||||
|
||||
def on_mercury(self):
|
||||
return round(
|
||||
self.age_in_seconds / self.seconds_earth_years / 0.2408467, self.precision
|
||||
)
|
||||
|
||||
def on_venus(self):
|
||||
return round(
|
||||
self.age_in_seconds / self.seconds_earth_years / 0.61519726, self.precision
|
||||
)
|
||||
|
||||
def on_mars(self):
|
||||
return round(
|
||||
self.age_in_seconds / self.seconds_earth_years / 1.8808158, self.precision
|
||||
)
|
||||
|
||||
def on_jupiter(self):
|
||||
return round(
|
||||
self.age_in_seconds / self.seconds_earth_years / 11.862615, self.precision
|
||||
)
|
||||
|
||||
def on_saturn(self):
|
||||
return round(
|
||||
self.age_in_seconds / self.seconds_earth_years / 29.447498, self.precision
|
||||
)
|
||||
|
||||
def on_uranus(self):
|
||||
retur round(
|
||||
self.age_in_seconds / self.seconds_earth_years / 84.016846, self.precision
|
||||
)
|
||||
|
||||
def on_neptune(self):
|
||||
return round(
|
||||
self.age_in_seconds / self.seconds_earth_years / 164.79132, self.precision
|
||||
)
|
||||
Reference in New Issue
Block a user