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