Compare commits
No commits in common. "03427a784f1b53625e1ecf0c63b43fa8a0fea954" and "7d1e7789029c15d9abc663f446abe82dba7c563e" have entirely different histories.
03427a784f
...
7d1e778902
@ -1,24 +0,0 @@
|
|||||||
class Block:
|
|
||||||
def __init__(self, dimensions: list):
|
|
||||||
self.width = dimensions[0]
|
|
||||||
self.length = dimensions[1]
|
|
||||||
self.height = dimensions[2]
|
|
||||||
|
|
||||||
def get_width(self):
|
|
||||||
return self.width
|
|
||||||
|
|
||||||
def get_length(self):
|
|
||||||
return self.length
|
|
||||||
|
|
||||||
def get_height(self):
|
|
||||||
return self.height
|
|
||||||
|
|
||||||
def get_volume(self):
|
|
||||||
return self.width * self.length * self.height
|
|
||||||
|
|
||||||
def get_surface_area(self):
|
|
||||||
return (
|
|
||||||
2 * self.length * self.height
|
|
||||||
+ 2 * self.width * self.height
|
|
||||||
+ 2 * self.width * self.length
|
|
||||||
)
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
class Quark(object):
|
|
||||||
def __init__(self, color, flavor):
|
|
||||||
self.color = color
|
|
||||||
self.flavor = flavor
|
|
||||||
self.baryon_number = 1 / 3
|
|
||||||
|
|
||||||
def interact(self, other) -> None:
|
|
||||||
self.color, other.color = other.color, self.color
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
class Vector(object):
|
|
||||||
def __init__(self, x: int, y: int):
|
|
||||||
self.x = x
|
|
||||||
self.y = y
|
|
||||||
|
|
||||||
def add(self, other):
|
|
||||||
return Vector(self.x + other.x, self.y + other.y)
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
from src.codewars.kata_building_blocks import Block
|
|
||||||
|
|
||||||
|
|
||||||
def test_block():
|
|
||||||
b1 = Block([2, 2, 2])
|
|
||||||
b2 = Block([41, 87, 67])
|
|
||||||
|
|
||||||
assert b1.get_width() == 2
|
|
||||||
assert b1.get_length() == 2
|
|
||||||
assert b1.get_height() == 2
|
|
||||||
assert b1.get_volume() == 8
|
|
||||||
assert b1.get_surface_area() == 24
|
|
||||||
assert b2.get_width() == 41
|
|
||||||
assert b2.get_length() == 87
|
|
||||||
assert b2.get_height() == 67
|
|
||||||
assert b2.get_volume() == 238989
|
|
||||||
assert b2.get_surface_area() == 24286
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
from src.codewars.kata_thinkful_quarks import Quark
|
|
||||||
|
|
||||||
|
|
||||||
def test_quark():
|
|
||||||
q1 = Quark("red", "up")
|
|
||||||
q2 = Quark("blue", "strange")
|
|
||||||
|
|
||||||
assert q1.color == "red"
|
|
||||||
assert q2.flavor == "strange"
|
|
||||||
assert q2.baryon_number == 1 / 3
|
|
||||||
|
|
||||||
q1.interact(q2)
|
|
||||||
|
|
||||||
assert q1.color == "blue"
|
|
||||||
assert q2.color == "red"
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
from src.codewars.kata_thinkful_vectors import Vector
|
|
||||||
|
|
||||||
|
|
||||||
def test_vector():
|
|
||||||
v1 = Vector(3, 4)
|
|
||||||
v2 = Vector(1, 2)
|
|
||||||
|
|
||||||
assert v1.x == 3
|
|
||||||
assert v2.y == 2
|
|
||||||
assert hasattr(v1, "add")
|
|
||||||
assert isinstance(v1.add(v2), Vector)
|
|
||||||
assert (v1.add(v2)).x == 4
|
|
||||||
assert (v1.add(v2)).y == 6
|
|
||||||
Loading…
x
Reference in New Issue
Block a user