PyCharm not Running Countdown code as Python runs it in its own shell.
已回答
Here's my code:
import time
clear = "\n" * 100000
count = 30
for seconds in range(count):
print(count,end=", ")
time.sleep(1)
count -= 1
print(clear)
When I run it in PyCharm, it definetly sleeps for 10, but then it prints all the numbers at once, and prints clear.
When I run it in IDLE/Python on its own, it counts down, and then clears.
Anyone know why?
Cheers,
Daf :)
请先登录再写评论。
Hello Daf,
> When I run it in PyCharm, it definetly sleeps for 10, but then it prints all the numbers at once, and prints clear.
Have you tried to run it in the system Terminal? For me the same behavior occurs in the system Terminal and python console, so I would say that it works as intended.