'Why Pycharm clears the very first lines of the output from the console for long outputs?
I wrote the code below. the very first line of the resulting output in the Pycharm console is different for the outputs that are not long with those that are long. I expected that it starts from "1" and scroll more and more for showing more output but it clears the very first lines by itself. :
code with the output that is not long (note the number "11"):
for x in range(1, 11):
print(str(x), str(x * x), end=' ')
print(str(x * x * x))
the first twelve lines of the console. the next lines are eliminated due to insignificancy (note it starts from the number "1"):
code with the output that is long (note the number "111111"):
for x in range(1, 111111):
print(str(x), str(x * x), end=' ')
print(str(x * x * x))
the very first line of its console (note it starts from the number "346" instead of "1"):
NOTE: I know I can see the rest of the results by pressing a key. my question is about the first line of the result, not the last line
Solution 1:[1]
That is because the console is only a certain number of lines long (looks like yours is 12) and you are just seeing the last 12 lines. If you scroll up you will see the rest... or you can print in a different way.
for example this:
for x in range(1, 111):
print(str(x), str(x * x), end=' ')
print(str(x * x * x))
# pause every 10 lines
if x % 10 == 0:
input('press a key to continue')
the output:
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
6 36 216
7 49 343
8 64 512
9 81 729
10 100 1000
press a key to continue
11 121 1331
12 144 1728
13 169 2197
14 196 2744
15 225 3375
16 256 4096
17 289 4913
18 324 5832
19 361 6859
20 400 8000
press a key to continue
21 441 9261
22 484 10648
23 529 12167
24 576 13824
25 625 15625
26 676 17576
27 729 19683
28 784 21952
29 841 24389
30 900 27000
press a key to continue
31 961 29791
32 1024 32768
33 1089 35937
34 1156 39304
35 1225 42875
36 1296 46656
37 1369 50653
38 1444 54872
39 1521 59319
40 1600 64000
press a key to continue
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | D.L |


