Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
Ashoka
Group Title
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
 one year ago
 one year ago
Ashoka Group Title
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
 one year ago
 one year ago

This Question is Closed

lopus Group TitleBest ResponseYou've already chosen the best response.1
n in range(56,66) what is n ? what is a b c? not defined
 one year ago

lopus Group TitleBest ResponseYou've already chosen the best response.1
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
 one year ago

Ashoka Group TitleBest ResponseYou've already chosen the best response.0
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
 one year ago

lopus Group TitleBest ResponseYou've already chosen the best response.1
[200,199,198,197.....] (200,0,1) start in 200 finish 0 decrees in 1
 one year ago

lopus Group TitleBest ResponseYou've already chosen the best response.1
man n is bad defined
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.