Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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



Enter two strictly positive integers: 23882 99900 23882 / 99900 has no finite expansion 23882 / 99900 = 0.23(905)* Prompts the user for two strictly positive integers, nunerator and denominator. Determines whether the decimal expansion of numerator / denominator is finite or infinite. Then computes integral part, sigma and tau such that numerator / denominator is of the form integral part. sigma tau tau tau... where integral part in an integer, sigma and tau are (possibly empty) strings of digits and sigma and tau are as short as possible. import sys from math import gcd try numerator, denominator input Enter two strictly positive integers ).split () except ValueError print ( Incorrect input, giving up.') sys. exit O try numerator, denominator-int (numerator), int (denominator) raise ValueError except ValueError print ( Incorrect input, giving up.') sys. exit) has finite_expansion -False integral part tau = # Replace this comment with your code if has finite_expansion else: if not tau print (f' In numerator / [denominatorl has a finite expansion') print (f n numertordenominator has no finite expansion') if not sigma else: print (f numeratorIdenominatorintegral_part]') print (f, {numerator} / {denoninator} = {integral-part), {signal,) else print (f numeratorIdenominatorintegral part. sigmal (Itaul)*')

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 numerator
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote