loops and functions exercise