'Python delete print [duplicate]
If I for example had a code like this:
score = 0
loop = true
while loop:
    score = (score) + 1
    print(score)
But I wanted to only print the new value of score instead of a long list of previous values aswell how would I do that?
Solution 1:[1]
print("Something", end='\r')
This way, any successive output will overwrite this one.
score = 0
while True:
    score += 1
    print(f"{score}  ", end='\r')
Notice that in Python true is undefined, and unlike C, C++, JavaScript and some other languages, True and False are uppercase.
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 | 
