python print list with newline 1

python print list with newline

my_list = [1, 2, 3, 4]
print(*my_list, sep="\n")

Here is what the above code is Doing:
1. The print function takes in a variable number of arguments.
2. The *my_list is unpacking the list into the print function.
3. The print function is printing each element of the list on a new line.

Similar Posts