kyu_6.potion_class_101 package

Submodules

kyu_6.potion_class_101.potion module

Solution for -> Potion Class 101.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_6.potion_class_101.potion.Potion(color: Tuple[int, int, int], volume: int)[source]

Bases: object

Potion.

This is your first potion class in Hogwarts and professor gave you a homework to figure out what color potion will turn into if he’ll mix it with some other potion. All potions have some color that written down as RGB color from [0, 0, 0] to [255, 255, 255]. To make task more complicated teacher will do few mixing and after will ask you for final color. Besides color, you also need to figure out what volume will have potion after final mix.

__calc_rgb(other, new_volume: int) Tuple[int, int, int]

Calculate RGB values.

Parameters:
  • other – Potion Object

  • new_volume – int

Returns:

tuple

property color: Tuple[int, int, int]

Get color value.

Returns:

tuple

mix(other) object[source]

Mix.

Based on your programming background you managed to figure that after mixing two potions colors will mix as if mix two RGB colors.

Note: Use ceiling when calculating the resulting potion’s color. :param other: Object :return: Potion Object

property volume: int

Return volume value.

Returns:

int

kyu_6.potion_class_101.test_potion module

Test for -> Potion Class 101.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_6.potion_class_101.test_potion.PotionTestCase(methodName='runTest')[source]

Bases: TestCase

Testing potion func for Potion Class 101 problem.

_classSetupFailed = False
_class_cleanups = []
test_potion()[source]

Testing potion function with various test inputs.

Returns:

Module contents

Potion Class 101.