- Engineering
- Computer Science
- for this code fix the smtax error this is a...
Question: for this code fix the smtax error this is a...
Question details
for this code fix the smtax error this is a python code for some reason my code isnt liking my returns and it bring up other symtax error so fix the following code
answer should pop out
the following when runned
1/ 2 + 1/ 3 + 1/ 12 = 11/12
z=' '
def math(x,y):
global z
if y==0 or x==0:
return
if y%x ==0:
z=("1/"+str(int(y/x))
return
if x%y ==0
z+=(int(x/y))
#return
if x>y:
z+=(int(x/y)," +
")
math(x%y,y)
#return
a=int(y/x)+1
z+=("1/"+str(a)+" + ")
math(int(x*a-y),int(y*a))
x=11
y=12
math(x,y)
print(z,"=",str(x)+"/"+str(y))
Solution by an expert tutor
