sovabids.misc#

Module with misc utilities for sovabids.

Module Contents#

Functions#

flat_paren_counter(string)

Count the number of non-nested balanced parentheses in the string. If parenthesis is not balanced then return -1.

get_num_digits(N)

Return the number of digits of the given number N.

sovabids.misc.flat_paren_counter(string)[source]#

Count the number of non-nested balanced parentheses in the string. If parenthesis is not balanced then return -1.

Parameters:

string (str) – The string we will inspect for balanced parentheses.

Returns:

The number of non-nested balanced parentheses or -1 if the string has unbalanced parentheses.

Return type:

int

sovabids.misc.get_num_digits(N)[source]#

Return the number of digits of the given number N.

Parameters:

N (int) – The number we want to apply the function to.

Returns:

The numbers of digits needed to represent the number N.

Return type:

int