Which statement is used to create an infinite loop in Python intentionally?
- break
- for i in range(10):
- if condition:
- while True:
To create an intentional infinite loop in Python, you can use the while True: statement. It will continue to execute the code block indefinitely until explicitly interrupted.
Loading...
Related Quiz
- In the context of method overriding, what is the role of the super() function?
- How would you prevent overfitting in a deep learning model when using frameworks like TensorFlow or PyTorch?
- The ____ function in Pandas is used to pivot a DataFrame to create a reshaped, sorted DataFrame.
- What is the primary use of the __init__ method in a Python class?
- Which of the following syntaxes is used to define an empty dictionary in Python?