functions and loops assignment