0

x = 2 while x < 400: print(x) x = x ** 2 while True: print(x**2, end=" ") if x == 400: break x = x **

Why this keeps printing and why doesn't accept break?

6th Aug 2020, 12:23 PM
Ashish Singh
2 Réponses
+ 3
You have placed your code in question title instead of linking it in description
6th Aug 2020, 12:28 PM
Abhay
Abhay - avatar
+ 1
2 ** 2 ---> 4 4 ** 2 ---> 16 16 ** 2 ---> 256 256 ** 2 ---> 65536 When the first loop broke the x was 65536. The second loop would break only if x == 400, but x were never equal to 400.
6th Aug 2020, 1:14 PM
Seb TheS
Seb TheS - avatar