anonymous
  • anonymous
Hi, I am trying to print number in the loop but its saying invalid syntax for last for loop. Please debug it. packages = (6,9,20) n in range (56,66) T = [] i =0 for i in range(1,100): for x in range(1,100): for y in range(1,100): for z in range(1,100): if n== a*x+b*y+c*z: T.append(n) for len(T) >0: print T[i] i=i+1
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
lopus
  • lopus
n in range(56,66) what is n ? what is a b c? not defined
lopus
  • lopus
def diophantine1(): a=raw_input("write a: ") b=raw_input("write b: ") c=raw_input("write c: ") package=[a,b,c] for n in range(200,0,-1): cont=0 for i in range(0,10): for j in range(0,10): for k in range(0,10): p=((int(package[0]))*i)+((int(package[1]))*j)+((int(package[2]))*k) if p==n: cont+=1 if cont==0: print ("the largest number of McNuggets that cannot be bought in exact quantity is:" + str(n)) break
anonymous
  • anonymous
Hi lopus, Thanks for ur time! import this packages = (6,9,20) n in range (56,66) T = [] i =0 for i in range(1,100): for x in range(1,100): for y in range(1,100): for z in range(1,100): if n== packages[0]*x+packages[1]*y+packages[2]*z: T.append(n) #for len(T) >0: #print T[i] #i=i+1 for num in T: print num I want the combination of 3 numbers please explain the below line in your code for n in range(200,0,-1): And also i want to know if there is syntax error in below line for num in T: print num

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

lopus
  • lopus
[200,199,198,197.....] (200,0,-1) start in 200 finish 0 decrees in -1
lopus
  • lopus
man n is bad defined

Looking for something else?

Not the answer you are looking for? Search for more explanations.