3 ms·
This isn't much impressive because can always import some package to do everything to you.
by flykespice 4mo ago
This isn't much impressive because can always import some package to do everything to you.
- teddyh 4mo agoNote that only Python standard modules are imported, no third-party libraries. The “random” module is needed, because Python does not have a built-in replacement for BASIC’s RND(). The “time” module is merely to add delays, to emulate the style of normal BASIC interpreters on old – i.e. very slow – computers. You could remove it without any change in output. And lastly, the “itertools” module is used to get an infinite loop on a Python one-liner; Python, with its whitespace-based block structure, has a hard time doing anything significant in a single line otherwise.
- stratos123 4mo agoYou could use `iter(lambda:1,0)` to get an infinite iterator, then itertools can be dropped.
- teddyh 4mo agoNice! python3 -c 'import random, time; any(time.sleep(0.01) or print(random.choice("\u2571\u2572"), end="", flush=True) for x in iter(lambda: 0, 1))'