Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
Time limit exceeded
Hello, I'm trying to execute small code in Python 3, but getting"Time limit exceeded" in the output always. Here is the code: import time i = 1 j= '*' while i <=5: if i <=3: print(j*i) time.sleep(1) # Delay to see the pattern else: print((3+(3-i))*j) time.sleep(1) # Delay to see the pattern i +=1
2 Antworten
+ 2
Remove time.sleep(1)
SoloLearn's Code Playground runs on someone else's PC. Which means you can't see the output in real time. So you can't use time.sleep()
+ 1
@qwerty Thank you.