Skip to content

Commit d356bd7

Browse files
author
Sourcery AI
committed
'Refactored by Sourcery'
1 parent 8322d13 commit d356bd7

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

Numbers/binary_decimal.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def decimal_to_binary(decimal):
2727
remainders.append(str(decimal % 2))
2828
decimal /= 2
2929
remainders.reverse()
30-
binary = "".join(remainders)
31-
return binary
30+
return "".join(remainders)
3231

3332
if __name__ == '__main__':
3433
print """

Numbers/prime.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
import math
66

77
def is_a_prime(x):
8-
for i in range(2, x):
9-
if x % i == 0:
10-
return False
11-
return True
8+
return all(x % i != 0 for i in range(2, x))
129

1310
# standard boilerplate
1411
if __name__ == '__main__':

0 commit comments

Comments
 (0)