End loop as soon as a number is output twice
I´d like to make the program end as soon as the number stops changing.
a = int(input(""))
Xn = 2
for i in range(100):
Xu = a / Xn
Xm = Xu + Xn
Xn = Xm * 0.5
print(f"{Xn}")
I think its possible with a loop and a list or something like that. I am learning programing pretty much through testing and tutorials and asking, so I don't know how to end it when it stops changing.
I mean I could just make the range 5 but it wouldn't be accurate.