Skip to content
Advertisement

For loop: how to print last element without blank space?

I have a strange problem which I cant figure out for some time now. I have 4 nested for loops and in the last one:

JavaScript

How can I remove the blank space the last time it prints, i.e the last time all flags are True? And I have to note that I still haven’t learned functions and lists.

Advertisement

Answer

Ok, this is a possible solution:

JavaScript

You can also consider using functools.reduce

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement