Which keyword is specifically used to terminate a loop prematurely?
- break
- exit
- halt
- terminate
The break keyword is used to prematurely terminate a loop in Python. When encountered, it exits the loop and continues with the next statement.
Loading...
Related Quiz
- You're working with a dictionary where keys are country names and values are their capitals. You want to invert this dictionary. What potential issue might you encounter?
- In Django, the ____ method is used to handle HTTP GET requests specifically in class-based views.
- You are asked to design an algorithm to reverse the words in a string ('hello world' becomes 'world hello'). Which approach would allow you to do this in-place, without using additional memory?
- How would you implement rate limiting in a RESTful API to prevent abuse?
- Which of the following sorting algorithms is most efficient for small-sized data sets?