0
why cant i use break it says invalid syntax. Whats wrong with it?
ash = 78 wood = 9 lucky = 569 while ash <= 162839: print(ash) ash = ash * 3 if ash >= 82929: break while wood <= 82919731927: print(wood) wood = wood ** 2 if wood >= 71991011: break while lucky <= 728173739291193773829177192729: print(lucky) lucky = lucky * 81920281728 if lucky > 666666666666662772717819: break
2 odpowiedzi
+ 6
Incorrect indentation.
ash = 78
wood = 9
lucky = 569
while ash <= 162839:
print(ash)
ash = ash * 3
if ash >= 82929:
break
while wood <= 82919731927:
print(wood)
wood = wood ** 2
if wood >= 71991011:
break
while lucky <= 728173739291193773829177192729:
print(lucky)
lucky = lucky * 81920281728
if lucky > 666666666666662772717819:
break
You need to indent the code you want to run for the if statement..
0
check your indention...
as c java works with { } we seem to hav a clear idea of which block of code in which loop or if else etc..
but in python it works with indention
if a==b :
do this
else :
if i<j:
do that