For example: I have a list filled with ints. I need to print it from a template(with '\n' between) with only one print():
>*sorted(lst)
>*reversed(lst)
I can't use sep or f-string because of unpacking lists. I found a bruteforce method.
int_lst = [4, 5, 2, 1]
lst = sorted(int_lst)
print(" ".join(str(i) for i in lst) + "\n" + " ".join(str(j) for j in reversed(lst)))
>1 2 4 5
>5 4 2 1
Isn't there any way to make it prettier and shorter?
My code sorts a list of integers and prints the sorted list twice, once in ascending order and once in descending order, with a newline between them.