Revision | d77d9d753afa680acbe7005f5e38a5d8d82a4ad0 (tree) |
---|---|
Time | 2024-04-12 06:42:50 |
Author | Albert Mietus < albert AT mietus DOT nl > |
Commiter | Albert Mietus < albert AT mietus DOT nl > |
refactored
@@ -117,23 +117,28 @@ | ||
117 | 117 | cons PRIMES:= [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]; |
118 | 118 | |
119 | 119 | if count >= len(PRIMES) { |
120 | - print("Warning: Can only check {len(PRIMES)} primes, {gotPrime) is not verified") | |
120 | + print("Warning: Can only check {len(PRIMES)} primes; {gotPrime) is not verified") | |
121 | 121 | return |
122 | 122 | } |
123 | 123 | |
124 | 124 | expect := PRIMES[count] |
125 | 125 | if expect != gotPrime { |
126 | 126 | printf("ERROR: Prime no {count} should be {expect}, but got {gotPrime}”) |
127 | - | |
127 | + } else { | |
128 | + printf("Success, found {gotPrime}, prime no {count} (verified)") | |
129 | + } | |
128 | 130 | count += 1; |
129 | 131 | }///ToContinue""" |
130 | 132 | if self.verifyCorrectPrime_count >= len(self.verifyCorrectPrime_PRIMES): |
131 | - print ("Warning: Can only check %s primes, {%s) is not verified" %( | |
133 | + print ("Warning: Can only check %s primes; %s is not verified" %( | |
132 | 134 | len(self.verifyCorrectPrime_PRIMES), gotPrime)) |
133 | 135 | return |
136 | + | |
134 | 137 | expect = self.verifyCorrectPrime_PRIMES[self.verifyCorrectPrime_count] |
135 | 138 | if expect != gotPrime: |
136 | 139 | print ("ERROR: Prime no %s should be %s, but got %s" % (self.verifyCorrectPrime_count, expect, gotPrime)) |
140 | + else: | |
141 | + print ("Success, found %s, prime no %s (verified)" % ( gotPrime, 1+self.verifyCorrectPrime_count)) | |
137 | 142 | self.verifyCorrectPrime_count +=1 |
138 | 143 | |
139 | 144 |