From 1c62bd10c19f6cf962159bd8f840ce2466309db0 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 19 May 2020 12:16:20 +0200 Subject: [PATCH] Precision must be a nonnegative integer (#2013) * Precision must be a nonnegative integer * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> --- data_structures/linked_list/singly_linked_list.py | 2 +- maths/bailey_borwein_plouffe.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data_structures/linked_list/singly_linked_list.py b/data_structures/linked_list/singly_linked_list.py index 516facc61..4377fc280 100644 --- a/data_structures/linked_list/singly_linked_list.py +++ b/data_structures/linked_list/singly_linked_list.py @@ -106,7 +106,7 @@ class LinkedList: raise IndexError("Index out of range.") current = current.next current.data = data - + def __len__(self): """ Return length of linked list i.e. number of nodes diff --git a/maths/bailey_borwein_plouffe.py b/maths/bailey_borwein_plouffe.py index 783466886..50a53c793 100644 --- a/maths/bailey_borwein_plouffe.py +++ b/maths/bailey_borwein_plouffe.py @@ -39,7 +39,7 @@ def bailey_borwein_plouffe(digit_position: int, precision: int = 1000) -> str: if (not isinstance(digit_position, int)) or (digit_position <= 0): raise ValueError("Digit position must be a positive integer") elif (not isinstance(precision, int)) or (precision < 0): - raise ValueError("Please input a nonnegative integer for the precision") + raise ValueError("Precision must be a nonnegative integer") # compute an approximation of (16 ** (n - 1)) * pi whose fractional part is mostly accurate sum_result = (