From fcfe35c3d8ed15037c0f20e3ee2268eea840b1ff Mon Sep 17 00:00:00 2001 From: samyakpagariya <72349392+samyakpagariya@users.noreply.github.com> Date: Sun, 30 Oct 2022 16:13:41 +0530 Subject: [PATCH] For the better understanding of time taken. (#6583) * For the better understanding of time taken. In this change I have initialized a variable p with the value of (1e9+7) and then took the modulus of process time with it . This modification gives better time taken by the process . Firstly it was giving answer in the exponential now it gives in the integer form. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Apply suggestions from code review Co-authored-by: Caeden Perelli-Harris Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss Co-authored-by: Caeden Perelli-Harris --- sorts/bubble_sort.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorts/bubble_sort.py b/sorts/bubble_sort.py index d4f0d25ca..aef2da272 100644 --- a/sorts/bubble_sort.py +++ b/sorts/bubble_sort.py @@ -49,4 +49,4 @@ if __name__ == "__main__": unsorted = [int(item) for item in user_input.split(",")] start = time.process_time() print(*bubble_sort(unsorted), sep=",") - print(f"Processing time: {time.process_time() - start}") + print(f"Processing time: {(time.process_time() - start)%1e9 + 7}")