From b6dc87f0160a18e509a8b1258b4d279fa30b9d7c Mon Sep 17 00:00:00 2001 From: Shiraz <24913281+smcclennon@users.noreply.github.com> Date: Wed, 27 Nov 2019 07:53:31 +0000 Subject: [PATCH] Only calculate stats when it is time to print --- Primer-C.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Primer-C.py b/Primer-C.py index e790696..494f5a3 100644 --- a/Primer-C.py +++ b/Primer-C.py @@ -1,6 +1,6 @@ # Primer Compatability version # github.com/smcclennon/Primer -ver = '1.0.1C' +ver = '1.0.2C' proj = 'Primer-C' @@ -54,11 +54,10 @@ for i in range(2,num): total=total+1 calculations=calculations+1 - taskDuration=round(time.time()-taskStart, 2) if num % i == 0: # If number is divisible by a number other than 1 or itself invalid = 1 - if invalid==0: + taskDuration=round(time.time()-taskStart, 2) nR='true' found=found+1 print(f'== {proj} v{ver} == Found Prime [#{found:,}]! ---> {num:,} <--- {calculations:,} calculations in {taskDuration} seconds --- Total Calculations: {total:,}')