In Python, a carriage return is represented by the escape sequence\r. This character moves the cursor back to the beginning of the line without advancing to the next line .when used in a string , it can have various effects depending on the context, such as over writing text in the same line in console
OUTPUT :
import time
for i in range(10):
print(f” counting : {i}”, end=”\r”)
time.sleep(1)
print(“Done! “)
OUTPUT:
Counting: 0 Counting: 1 Counting:2 Counting: 3 Counting: 4 Counting : 5 Counting: 6 Counting: 7 Counting : 8 Counting : 9 Done!