exercise 6 from advanced  topics of corsecadameys python course