Under what circumstances would one use a while statement rather than for ?



Under what circumstances would one use a while statement rather than for ?..

Answer / Raja Singh

In Python's Django, while loops are often used when the number of iterations is not known beforehand or when a loop needs to continue until a certain condition is met. For example, if you're creating an application that fetches data from an API where the number of items may vary, a while loop would be more appropriate.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Django Python Interview Questions

What is as_view in django?

1 Answers  


What is exception handling? How do you achieve it in python?

1 Answers  


What is the use of django framework?

1 Answers  


How does django migrate work?

1 Answers  


When and who create django?

1 Answers  


Is django a mvc?

1 Answers  


What is template view django?

1 Answers  


Who use django?

1 Answers  


Why is django popular?

1 Answers  


What is a class? How do you create it in python ?

1 Answers  


What is the difference between django and python?

1 Answers  


How do I make a python script executable on unix ?

1 Answers  


Categories