Hey there and welcome to the Codecademy forums!!
First off I would like to say the solution code isn’t always the “better” solution, but often just a solution.
In your case, you could argue the solution code is more efficient than yours since it use a
while loop as opposed to a
for loop. For example if we give each function a list:
[2, 4, 3, 5, 7, 9, 11]
for loop will loop through every number in the list, as opposed to the solutions
while loop which will terminate as soon as it finds an odd number. Less loops means less run time, which can be important when working with lots of data.
You could fix this with a
break but the
while loop is a lot more compact and easier to read.