Skip to content

Commit 298768a

Browse files
meg-1cclauss
andauthored
Implementing suggestions in maths/numerical_analysis/proper_fractions.py
Co-authored-by: Christian Clauss <[email protected]>
1 parent 8c6fe27 commit 298768a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

maths/numerical_analysis/proper_fractions.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ def proper_fractions(denominator: int) -> list[str]:
3131

3232
if denominator < 0:
3333
raise ValueError("The Denominator Cannot be less than 0")
34-
fractions: list[str] = []
35-
for numerator in range(1, denominator):
36-
if gcd(numerator, denominator) == 1:
37-
fractions.append(f"{numerator}/{denominator}")
38-
return fractions
34+
return [f"{numerator}/{denominator}" for numerator in range(1, denominator) if gcd(numerator, denominator) == 1]
3935

4036

4137
if __name__ == "__main__":

0 commit comments

Comments
 (0)