Output: Enter two strictly positive integers: 12300 123 12300 / 123 has a finite
ID: 3730343 • Letter: O
Question
Output:
Enter two strictly positive integers: 12300 123
12300 / 123 has a finite expansion
12300 / 123 = 100
Enter two strictly positive integers: 12356 1024
12356 / 1024 has a finite expansion
12356 / 1024 = 12.06640625
Explanation / Answer
import sys from math import gcd def check_denominator_form(d): while d % 2 == 0: d = d / 2 while d % 5 == 0: d = d / 5 if d == 1: return True return False def find_sig_tau(num, den): dictr = {} result = "" rem = num % den while rem != 0 and rem not in dictr: dictr[rem] = result.__len__() rem = rem * 10 result += str(int(rem/den)) rem = rem % den if rem == 0: return "", "" else: return result[:dictr[rem]], result[dictr[rem]:] def solve(): try: numerator, denominator = input("Enter two Strictly positive integers: ").split() except ValueError: print("Incorrect input, giving up") sys.exit() try: numerator, denominator = int(numerator), int(denominator) if numeratorRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.