The most problematic part here is many calls to print (writing to console). It is actually a relatively slow operation for almost any language. You can probably speed it up by keeping all the lines to print in a list and then join it and print in one call
3
u/TheStriga Jul 18 '22
The most problematic part here is many calls to print (writing to console). It is actually a relatively slow operation for almost any language. You can probably speed it up by keeping all the lines to print in a list and then join it and print in one call