IBM Interview Question

Can you solve this Python script problem using a recursive function instead of loops?