import time
def exitpro(t):
a=0
while t>=0:
timer="Loading "+"."*((a%3)+1)
print(timer,end='\r')
time.sleep(1)
t-=1
a+=1
t=int(input("enter time in seconds "))
exitpro(int(t))
I am doing this on jupyter notebook. I want to print something like "loading." then after one sec "loading.." then "loading..." then again "loading.". But when I run this it prints till 3 dots and then prints the loading with one dot overlapping the loading with 3 dots, so it looks like the program is stuck at loading with 3 dots. Basically, it does not clear the above line, rather prints over it. Please help.