I was writing some code for a "map chooser" and want it to cycle through maps in a line
Here's the code:
maps = ["moon", "earth", "mars", "venus", "jupiter", "saturn", "uranus", "neptune", "houses", "floodland"]
while True:
map = random.choice(maps)
sys.stdout.write(map)
sys.stdout.write("\r")
time.sleep(1)
Desired result is it cycling through all the maps in a single line, choosing a map, showing it, choosing another map, removing the other map and showing the new map in the same line and so on. What I actually get is the maps getting mixed up with each other like, I get earthland when it cycles through FloodLand and Earth.
What is the problem and how I can resolve it?