How to replace a printed integer?! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to replace a printed integer?!

Hi guys, I’m very new in programming and need your help. I want to change this code: X=0 while True: Print(x) X += 1 As you know this code causes to counting in consol, I want that exactly: one integer will print and the previous integer get delete! Please answer, thank you so much...

7th Jul 2018, 12:45 AM
Mohammad Moharrami
Mohammad Moharrami - avatar
4 Answers
+ 1
X=0 while True: X += 1 Print(x)
7th Jul 2018, 1:36 AM
Andre Daniel
Andre Daniel - avatar
+ 1
That's just how the print method works. My best assumption is to print the x after the while loop has ended so you only get the last one. In Javascript you can use console.clear() then console.log() to print one at a time, but I don't know of any clear() existing in python, sorry.
7th Jul 2018, 2:03 AM
Andre Daniel
Andre Daniel - avatar
+ 1
Ok, thank you anyway
7th Jul 2018, 2:06 AM
Mohammad Moharrami
Mohammad Moharrami - avatar
0
No it results same! I want replacement, for example when 10 is printing, 9 get delete, I mean counting somehow like chornometer!
7th Jul 2018, 1:56 AM
Mohammad Moharrami
Mohammad Moharrami - avatar