python - Syntax exception -
i getting syntax exception in code @ a** + b** == c**: don't know prob me out..
def getvalue(): a, b,c =1,2,3; while a: while b: while c: if + b + c == 1000 , a** + b** == c**: print("a : {} b : {} c:{}".format( a, b, c)) return a*b*c; else: c += 1; b += 1; a+=1; print("answer : {}".format(getvalue())) for guys put negative question accept mistake did giving negatives post make me feel not ask question. if not related topic on site, can provide negative. mistakes , ask review , if find silly did after getting know mistake should not give negative, thats demotivating.
wild guess:
if + b + c == 1000 , a**2 + b**2 == c**2: notice looping on c pointless here, can use c = 1000 - b - a
also use for loops instead of while. porting other language?
def getvalue(): in range(1, 1000): b in range(a, 1000): c = 1000 - - b if ** 2 + b ** 2 == c ** 2: print("a : {} b : {} c:{}".format(a, b, c)) return * b * c
Comments
Post a Comment