FAHIM_py's blog

By FAHIM_py, history, 2 months ago, In English

from fractions import Fraction x,y,n=int(input()),int(input()),int(input())

f=Fraction(x,y).limit_denominator(n)

print(str(f.numerator)+"/"+str(f.denominator))

I have submitted the code bt shows runtime error on test 1 can anyone help me please?

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

You're reading the input wrong: it should be something like

x, y, n = map(int, input().split())

Your code expects three lines, one number in each; mine expects a single line with three space-separated numbers.