Skip to content
Advertisement

Is there a way to make “print(l for l in List)” work?

Hi

I am trying to shorten my code with some for loops inside of print functions, but I run into this problem:

JavaScript

Output:

JavaScript

is there a way to make this work without doing:

JavaScript

Output:

JavaScript

or do I have to stick with that?

I am sorry if this question is somewhere else, I just couldn’t find it. If you manage to find it, feel free to send a link instead of explaining it here too.

thanks in advance

Advertisement

Answer

You cannot use loop inside print() but you can do

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