rocket-aymen 1.0.0__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.
rocket/__init__.py ADDED
@@ -0,0 +1 @@
1
+ import rocket
rocket/rocket.py ADDED
@@ -0,0 +1,62 @@
1
+ # Save as rocket.py
2
+ from math import sqrt, pi
3
+
4
+
5
+ class Rocket():
6
+ # Rocket simulates a rocket ship for a game, or a physics simulation.
7
+
8
+ def __init__(self, x=0, y=0):
9
+ # Each rocket has an (x,y) position.
10
+ self.x = x
11
+ self.y = y
12
+
13
+ def move_rocket(self, x_increment=0, y_increment=1):
14
+ # Move the rocket according to the parameters given.
15
+ # Default behavior is to move the rocket up one unit.
16
+ self.x += x_increment
17
+ self.y += y_increment
18
+
19
+ def get_distance(self, other_rocket):
20
+ # Distance from this rocket to another rocket.
21
+ return sqrt((self.x - other_rocket.x) ** 2
22
+ + (self.y - other_rocket.y) ** 2)
23
+
24
+ # ---- Added for Challenge 4.2 (equality from Challenge 1) ----
25
+ def __eq__(self, other):
26
+ if not isinstance(other, Rocket):
27
+ return NotImplemented
28
+ return self.x == other.x and self.y == other.y
29
+
30
+ def __str__(self):
31
+ return f"A Rocket positioned at ({self.x},{self.y})"
32
+
33
+ def __repr__(self):
34
+ return f"Rocket({self.x},{self.y})"
35
+
36
+
37
+ class Shuttle(Rocket):
38
+ # Shuttle simulates a space shuttle, which is really just a reusable rocket.
39
+
40
+ def __init__(self, x=0, y=0, flights_completed=0):
41
+ super().__init__(x, y)
42
+ self.flights_completed = flights_completed
43
+
44
+
45
+ # ---- Added for Challenge 4.3 ----
46
+ class CircleRocket(Rocket):
47
+ # A rocket shaped like a circle of radius r.
48
+
49
+ def __init__(self, x=0, y=0, r=1):
50
+ super().__init__(x, y)
51
+ self.r = r
52
+
53
+ def get_area(self):
54
+ return pi * self.r ** 2
55
+
56
+ def get_circumference(self):
57
+ return 2 * pi * self.r
58
+
59
+ def __repr__(self):
60
+ return f"CircleRocket({self.x},{self.y},{self.r})"
61
+
62
+
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.4
2
+ Name: rocket-aymen
3
+ Version: 1.0.0
4
+ Summary: An awesome package that does something
5
+ Home-page: http://pypi.python.org/pypi/<your_package_name>/
6
+ Author: <author_name>
7
+ Author-email: a.boualdja@esi-sba.dz
8
+ License: LICENSE.txt
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE.txt
11
+ Dynamic: author
12
+ Dynamic: author-email
13
+ Dynamic: description-content-type
14
+ Dynamic: home-page
15
+ Dynamic: license
16
+ Dynamic: license-file
17
+ Dynamic: summary
@@ -0,0 +1,7 @@
1
+ rocket/__init__.py,sha256=OVg_klU3vMPVS_KlhcEU1WM1B5moDYWhYUHXQhZdpUg,13
2
+ rocket/rocket.py,sha256=ZI_a0XqoKWWo6U69SdJytKI3IOJ1LecZsiSAOg7u0Vo,1802
3
+ rocket_aymen-1.0.0.dist-info/licenses/LICENSE.txt,sha256=GSAKapQH5ZIGWlpQTA7v5YrfECyaxaohUb1vJX-qepw,1090
4
+ rocket_aymen-1.0.0.dist-info/METADATA,sha256=l5ivsfsLuTE_UdGa9whDgtf3iwAPNKZTSTbUd5-XOPo,473
5
+ rocket_aymen-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
6
+ rocket_aymen-1.0.0.dist-info/top_level.txt,sha256=iuGgWVgdNIZpR_FKX9YIEjWhtHhHoT4EJNDTvYSLF8Y,7
7
+ rocket_aymen-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ rocket