DHI Group interview question

Some question about Python coding