Print a list without all the empty elements of the list

I would like to know if there is a fast way to print all the not empty elements of a string list in Java. Currently, this is my code and it works, but I would like to know if there is another, shorter way to do it. That means without creating a "cloned list" from… Read More Print a list without all the empty elements of the list

How can I make my recursion program to output factorial of a number more efficient?

I have made a Program which outputs the factorial of a number by calling the function: factorial() which uses recursion to calculate and return the value. I have also included a loop to break the program when the User inputs the word "off". Please suggest any improvements HERE IS THE CODE: def factorial(base): if base… Read More How can I make my recursion program to output factorial of a number more efficient?