0
I only have 7 lines of code but the time limit exceeds, one integer value, 3 prints, and a while command, whats wrong. Descript
d = 1 print ('test') print ('test') while d > 0: print (d) d = d + 1 while d == 365 print ('one year passed') What's wrong with it, it's Python
6 odpowiedzi
+ 1
Your first loop is infinite, d is always greater than 0. For that matter if you were to reach the second it would also be infinite. plus you're missing a colon.
Try
d = 1
print ('test')
print ('test')
while d < 365:
print (d)
d = d + 1
if d == 365:
print ('one year passed')
0
oh, it's meant to be infinite, and I just forgot about the colon, it's on my code, any other ideas though. I don't get what's wrong
0
This is probably more of what you're after, but it won't run in the playground do to the loop timing restrictions.
d = 1
while True:
print (d)
d = d + 1
if d % 365 == 0:
print ('one year passed')
Try running on your computer or another online IDE like the ones at tutorialspoint.com
0
thx, know anything that runs on an Android phone that I can use to run Python and has no time limit
0
Just search the play store. pydriod is a good python IDE for Android, but it only works with python 2. Pyonic python 3 interpreter may work. You may also want to use sleep() on the loop to slow it down.
from time import sleep
sleep(1)
loop is infinite so cntrl-c to stop it fyi.
0
thx dude