Hermann, you wrote "solve" before, well, we solve puzzles, this is not a puzzle, it is an exercise intended to 1. Tell your professor how much you have understood of the class you have taken 2. Give you practice in creating code. If we do your homework we would be preventing both of these from happening. You have not shown any evidence that you have tried to produce anything.
The code I posted is only an example to understand.
I don't understand this excuse that you have taken, as the professor does not receive, does not help and does not repeat the lesson.
If I posted in a forum of programming support, I think it will serve to give aid and support of all kinds and in any case the code will also serve other users of the forum.
I have no help, I have only your support, so if I can not solve and operate the program I will not be able to continue my studies, for this reason examine your conscience and
tell me if you can help me definitely.