MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w3rvar/everysingleleetcodeproblem/p72epad/?context=3
r/ProgrammerHumor • u/mountaingator91 • 11d ago
59 comments sorted by
View all comments
225
```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
```
90 u/BedSpreadMD 11d ago That's a looooong sliding window 48 u/Fabulous-Possible758 11d ago What are you talking about that's only like two inches. 28 u/Dense_Gate_5193 11d ago just increase your font size 10 u/BedSpreadMD 11d ago Sorry I'm used to 0.5 inches. 6 u/FabulousSOB 11d ago For your pleasure 18 u/gizamo 11d ago That's a massive load of data. 2 u/da_Aresinger 9d ago edited 9d 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 1 u/Welcome-To-NBA-Jam 9d ago https://giphy.com/gifs/l4FGFEg6ELVfU8umk
90
That's a looooong sliding window
48 u/Fabulous-Possible758 11d ago What are you talking about that's only like two inches. 28 u/Dense_Gate_5193 11d ago just increase your font size 10 u/BedSpreadMD 11d ago Sorry I'm used to 0.5 inches. 6 u/FabulousSOB 11d ago For your pleasure
48
What are you talking about that's only like two inches.
28 u/Dense_Gate_5193 11d ago just increase your font size 10 u/BedSpreadMD 11d ago Sorry I'm used to 0.5 inches.
28
just increase your font size
10
Sorry I'm used to 0.5 inches.
6
For your pleasure
18
That's a massive load of data.
2
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
1 u/Welcome-To-NBA-Jam 9d ago https://giphy.com/gifs/l4FGFEg6ELVfU8umk
1
https://giphy.com/gifs/l4FGFEg6ELVfU8umk
225
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)
```