Describe what this function does. Try different numbers as input.

```
def test(num):
if num > 0:
return test(num-1) + num
else:
return 0
```

This method recursively calls itself with a decremented number, but adds that decremented number to the returned value till it hits 0. This causes it to return 3 for 2, 6 for 3, 10 for 4, and so on.

Computer Science & Information Technology

You might also like to view...

Sun Microsystem's StarOffice is the most notable open-source application and a direct alternative to Microsoft Office

Indicate whether the statement is true or false

Computer Science & Information Technology

The Save As dialog box typically displays only files created by the program currently in use

Indicate whether the statement is true or false

Computer Science & Information Technology