rim-rocket 0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
rim_rocket-0.1.dist-info/licenses/LICENSE.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
rocket/__init__.py,sha256=s5ILZ2sYaM9k-wDOwQNS-k6L1V4TOthEop-rS8y2Jn4,50
|
|
3
|
+
rocket/rocket.py,sha256=PUkIdEJhm3ZbIu9_23Dtzh9iWn6_hzaxne2EnE_O96A,1057
|
|
4
|
+
rim_rocket-0.1.dist-info/METADATA,sha256=CZnwuk0r-CUSES47q3ouHlcR6Ly4xsOaCNrzXeWiqNY,100
|
|
5
|
+
rim_rocket-0.1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
6
|
+
rim_rocket-0.1.dist-info/top_level.txt,sha256=iuGgWVgdNIZpR_FKX9YIEjWhtHhHoT4EJNDTvYSLF8Y,7
|
|
7
|
+
rim_rocket-0.1.dist-info/RECORD,,
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rocket
|
rocket/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .rocket import Rocket, Shuttle, circleRocket
|
rocket/rocket.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from math import sqrt, pi
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Rocket:
|
|
5
|
+
def __init__(self, x=0, y=0):
|
|
6
|
+
self.x = x
|
|
7
|
+
self.y = y
|
|
8
|
+
|
|
9
|
+
def move_rocket(self, x_increment=0, y_increment=1):
|
|
10
|
+
self.x += x_increment
|
|
11
|
+
self.y += y_increment
|
|
12
|
+
|
|
13
|
+
def get_distance(self, other_rocket):
|
|
14
|
+
distance = sqrt(
|
|
15
|
+
(self.x - other_rocket.x)**2 +
|
|
16
|
+
(self.y - other_rocket.y)**2
|
|
17
|
+
)
|
|
18
|
+
return distance
|
|
19
|
+
|
|
20
|
+
def __eq__(self, other):
|
|
21
|
+
return self.x == other.x and self.y == other.y
|
|
22
|
+
|
|
23
|
+
def __str__(self):
|
|
24
|
+
return f"A Rocket positioned at ({self.x},{self.y})"
|
|
25
|
+
|
|
26
|
+
def __repr__(self):
|
|
27
|
+
return f"Rocket({self.x},{self.y})"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class Shuttle(Rocket):
|
|
31
|
+
def __init__(self, x=0, y=0, flights_completed=0):
|
|
32
|
+
super().__init__(x, y)
|
|
33
|
+
self.flights_completed = flights_completed
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class circleRocket(Rocket):
|
|
37
|
+
def __init__(self, x=0, y=0, r=1):
|
|
38
|
+
super().__init__(x, y)
|
|
39
|
+
self.r = r
|
|
40
|
+
|
|
41
|
+
def get_area(self):
|
|
42
|
+
return pi * self.r**2
|
|
43
|
+
|
|
44
|
+
def get_circumference(self):
|
|
45
|
+
return 2 * pi * self.r
|