code snippets for solving exercises in star and planet formation