Basic Functions

rsokl_dummy.basic_functions.count_vowels(x, include_y=False)[source]

Returns the number of vowels contained in x. The vowel ‘y’ is included optionally.

Parameters
xstr

The input string

include_ybool, optional (default=False)

If True count y’s as vowels

Returns
vowel_count: int

Examples

>>> count_vowels("happy")
1
>>> count_vowels("happy", include_y=True)
2
rsokl_dummy.basic_functions.merge_max_mappings(dict1, dict2)[source]

Merges two dictionaries based on the largest value in a given mapping.

Parameters
dict1Dict[str, float]
dict2Dict[str, float]
Returns
mergedDict[str, float]

The dictionary containing all of the keys common between dict1 and dict2, retaining the largest value from common mappings.

Examples

>>> x = {"a": 1, "b": 2}
>>> y = {"b": 100, "c": -1}
>>> merge_max_mappings(x, y)
{'a': 1, 'b': 100, 'c': -1}