Post History
Replace for loops with string multiplication Let's say we have: for i in range(6):print(end="#") Try it online! This basically outputs # 6 times, which is self-explanatory in the code itsel...
Answer
#1: Initial revision
# Replace `for` loops with string multiplication Let's say we have: <!-- language-all: lang-python --> for i in range(6):print(end="#") [Try it online!][TIO-kt9iruha] [TIO-kt9iruha]: https://tio.run/##K6gsycjPM/7/Py2/SCFTITNPoSgxLz1Vw0zTqqAoM69EIzUvxVZJWUnz/38A "Python 3 – Try It Online" This basically outputs `#` 6 times, which is self-explanatory in the code itself. Perhaps we can shorten it with string multiplication: <!-- language-all: lang-python --> print(end="#"*6) [Try it online!][TIO-kt9iuhaq] [TIO-kt9iuhaq]: https://tio.run/##K6gsycjPM/7/v6AoM69EIzUvxVZJWUnLTPP/fwA "Python 3 – Try It Online" Same result, lesser bytes.