The for statement emphasizes through a collection or iterable object or a generator function
The while statement basically loops until a condition is False.
Click on this following link, if you want to know more details about for loop and while loop.
It isn't a preference. It's an issue of what your data structures are.
Join the python online course fast, to learn python concepts in detail and get certified.