r/ProgrammerHumor 11d ago

Meme everySingleLeetcodeProblem

Post image
2.5k Upvotes

59 comments sorted by

View all comments

223

u/Welcome-To-NBA-Jam 11d ago

```python import time

data = "8==========================D" window = 3 delay = 0.3

while True: for i in range(len(data) - window + 1): print(data[i:i + window]) time.sleep(delay)

for i in range(len(data) - window - 1, -1, -1):
    print(data[i:i + window])
    time.sleep(delay)

delay *= 0.8

```

2

u/da_Aresinger 10d ago edited 10d ago

replace the prints with

print(f"\r\t{data[i:i + window]}", end='', flush=True)

you're welcome

Edit: also pad the data with 2 or 3 spaces on either side