0

Loop times

How many times can loops run? Here's my program: x=int(input()) while x<=1000 print(x) x=x+1 print("the end") Sometimes x=101 worked and sometimes it only showed time limit exceed Why? Does anyone have the same problem?

3rd Feb 2017, 10:19 AM
C.R.Devila
C.R.Devila - avatar
11 Réponses
+ 6
Like left13 said, you missed out on the colon symbol after while statement.
3rd Feb 2017, 10:37 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
@left13 Thanks, the program runs very well
3rd Feb 2017, 11:19 AM
C.R.Devila
C.R.Devila - avatar
+ 1
while x <=1000: .Write it like this and i think it will works.
3rd Feb 2017, 10:34 AM
lefteris13s
lefteris13s - avatar
+ 1
@left13 @Hatsy rei oops I forgot it here😂 Thanks But I did write in my program
3rd Feb 2017, 10:39 AM
C.R.Devila
C.R.Devila - avatar
+ 1
@left13 Sometimes it works, sometimes not I know it sounds weird, but that's what happened
3rd Feb 2017, 10:54 AM
C.R.Devila
C.R.Devila - avatar
+ 1
@left13 numbers: around 100 message: time limit exceeded I think it's not an error message since the output only have three words"time limit exceeded"
3rd Feb 2017, 11:08 AM
C.R.Devila
C.R.Devila - avatar
+ 1
@left13 Um, yes
3rd Feb 2017, 11:11 AM
C.R.Devila
C.R.Devila - avatar
0
So the program is now working?
3rd Feb 2017, 10:49 AM
lefteris13s
lefteris13s - avatar
0
For what input it doesn't work and what is the error message in the compiler?
3rd Feb 2017, 11:00 AM
lefteris13s
lefteris13s - avatar
0
you are running it via this app's compiler?
3rd Feb 2017, 11:09 AM
lefteris13s
lefteris13s - avatar
0
Install Qpython,maybe is compiler's error
3rd Feb 2017, 11:12 AM
lefteris13s
lefteris13s - avatar