6 kyu
Implement the Fractions class
1,022 of 1,630Dr.RiD
Description:
You are provided with a skeleton of the class Fraction
, which accepts two arguments (numerator, denominator).
Your task is to make this class string representable, and addable while keeping the result in the minimum representation possible.
Note: your class should not subclass fractions.Fraction
Example
fraction1 = Fraction(4, 5)
print(fraction1 + Fraction(1, 8))
# outputs: 37/40
Enjoy!
Fundamentals
Object-oriented Programming
Similar Kata:
Stats:
Created | May 5, 2016 |
Published | May 5, 2016 |
Warriors Trained | 3995 |
Total Skips | 121 |
Total Code Submissions | 10030 |
Total Times Completed | 1630 |
Python Completions | 1022 |
C# Completions | 242 |
Haskell Completions | 36 |
Java Completions | 359 |
Total Stars | 82 |
% of votes with a positive feedback rating | 89% of 246 |
Total "Very Satisfied" Votes | 198 |
Total "Somewhat Satisfied" Votes | 41 |
Total "Not Satisfied" Votes | 7 |
Total Rank Assessments | 8 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |