for seq comprehension vs while loop and use when to validate input