You don't really need a while loop here. You're only wanting to get a single input every time you call this function, so there's no reason to loop through anything.