diff --git a/codewars/Aufgabe2.py b/codewars/Aufgabe2.py index 8f0273b..8a045c4 100644 --- a/codewars/Aufgabe2.py +++ b/codewars/Aufgabe2.py @@ -9,4 +9,5 @@ class Ship: # Jedes Besatzungsmitglied erhöht den Tiefgang um 1,5 Einheiten. # Ein Schiff ist lohnenswert, wenn der verbleibende Tiefgang nach Abzug # des Gewichts der Besatzung mehr als 20 Einheiten beträgt. - return (self.draft - (self.crew * 1.5)) > 20 \ No newline at end of file + return (self.draft - (self.crew * 1.5)) > 20 + \ No newline at end of file diff --git a/codewars/Interactive Dictionary.py b/codewars/Interactive Dictionary.py new file mode 100644 index 0000000..c59bd75 --- /dev/null +++ b/codewars/Interactive Dictionary.py @@ -0,0 +1,12 @@ +class Dictionary: + def __init__(self): + self.words = {} + + def newentry(self, word, definition): + self.words[word] = definition + + def look(self, key): + if key in self.words: + return self.words[key] + else: + return f"Can't find entry for {key}" \ No newline at end of file diff --git a/codewars/building blocks.py b/codewars/building blocks.py index e69de29..1c6ab0d 100644 --- a/codewars/building blocks.py +++ b/codewars/building blocks.py @@ -0,0 +1,15 @@ +class Block: + def __init__(self, dims): + self.width = dims[0] + self.length = dims[1] + self.height = dims[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.width * self.length + self.width * self.height + self.length * self.height) \ No newline at end of file diff --git a/src/solution.py b/src/solution.py index 782cfce..2033fb2 100644 --- a/src/solution.py +++ b/src/solution.py @@ -3,3 +3,4 @@ def even_or_odd(number): return "Even" else: return "Odd" +