first and second, each the notation of a non-negative rational number. Return True if they denote the same number and False otherwise.
A notation takes one of three forms:
- an integer part only: 7, 0, 250;
- an integer part, a dot and an optional finite fractional part: 0.25, 3., 12.0408;
- the same followed by a period in parentheses that repeats forever: 0.(6), 1.2(45), 5.(9).
For instance, 0.1(6), 0.16(6) and 0.1(66) all mean 0.1666… = 1/6.first="0.(36)", second="0.3(63)" → True
Both stand for 0.363636…
first="2.4(9)", second="2.5" → True
2.4999… with nines forever is exactly 2.5.
first="0.(3)", second="0.33" → False
0.333… is 1/3, while 0.33 is a little less.
0 itself)first="0.(36)", second="0.3(63)"
True
Run checks the first 3 tests in your browser. Submit checks all 90 tests on the server, hidden ones included.