kyu_8.logical_calculator package

Submodules

kyu_8.logical_calculator.logical_calculator module

Solution for -> Logical Calculator.

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

kyu_8.logical_calculator.logical_calculator.logical_calc(array: list, op: str) bool[source]

Calculate logical value of boolean array.

Logical operations: AND, OR and XOR.

Begins at the first value, and repeatedly apply the logical operation across the remaining elements in the array sequentially.

Parameters:
  • array – list

  • op – str

Returns:

bool

kyu_8.logical_calculator.test_logical_calculator module

Test for -> Logical Calculator.

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

class kyu_8.logical_calculator.test_logical_calculator.LogicalCalculatorTestCase(methodName='runTest')[source]

Bases: TestCase

Testing logical_calc function.

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

And (∧) is the truth-functional operator of logical conjunction.

The ‘and’ of a set of operands is true if and only if all of its operands are true.

Source: https://en.wikipedia.org/wiki/Logical_conjunction :return:

test_logical_calc_or()[source]

Testing ‘or’.

In logic and mathematics, or is the truth-functional operator of (inclusive) disjunction, also known as alternation.

The ‘or’ of a set of operands is true if and only if one or more of its operands is true.

Source: https://en.wikipedia.org/wiki/Logical_disjunction

Returns:

test_logical_calc_xor()[source]

Testing ‘XOR’.

Exclusive or exclusive disjunction is a logical operation that outputs true only when inputs differ (one is true, the other is false).

XOR outputs true whenever the inputs differ:

Source: https://en.wikipedia.org/wiki/Exclusive_or :return:

Module contents

Logical calculator.