Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Practical 2/q12_find_factors.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Finding the factors of an integer
# by Yiyang 29/01/18

# gisc: avoid single letter variables and underscore prefix _ in identifier names
N = int(input())
i = 2 # i is the factor & the iterator
_first = True # for the printing format

while (N >= i):
if (N % i == 0):
N /= i
N /= i # use integer divisor // in Python 3
if _first == True:
print(i, end='')
_first = False
Expand All @@ -16,4 +16,4 @@
else:
i += 1

print('.')
print('.')