we can have less lines of code if we assert this with the help of a loop