+ 1

It is showing time limit exceeded why

a=2 while a>1: print ('mad')

16th Jun 2019, 9:18 AM
Sumit Jaiswal
Sumit Jaiswal - avatar
4 Respostas
+ 4
Look at the explanation you got here five minutes ago: https://www.sololearn.com/Discuss/1846537/?ref=app
16th Jun 2019, 9:21 AM
Anna
Anna - avatar
+ 3
Sumit Jaiswal You don't change the value of a in the loop. So the loops checks always 2 > 1 -> always true. A while loops runs until the condition gets false.
16th Jun 2019, 9:42 AM
Denise Roßberg
Denise Roßberg - avatar
+ 1
It's an infinite loop, "a" will always be bigger than 1 as you gave it the value 2
16th Jun 2019, 9:21 AM
Mo Hani
Mo Hani - avatar
+ 1
A is greater than 1 it's true then why
16th Jun 2019, 9:22 AM
Sumit Jaiswal
Sumit Jaiswal - avatar