What is the main purpose of a loop in Python?
A. To write comments
B. To execute code only once
C. To repeat a block of code
D. To define functions
Answer: Option C
Solution (By Examveda Team)
The main purpose of a loop in Python is to repeat a block of code.Loops are fundamental control structures in programming languages that allow the execution of a certain block of code repeatedly. In Python, loops such as for loops and while loops enable you to iterate over sequences, perform operations on elements, and execute code multiple times based on specified conditions. This capability is essential for automating repetitive tasks, processing large amounts of data, and implementing algorithms that require repeated execution of certain steps.
Related Questions on Introduction to Python
What is Python primarily used for?
A. Web browsing
B. Data analysis
C. Video editing
D. Game development
Who developed Python Programming Language?
A. Wick van Rossum
B. Rasmus Lerdorf
C. Guido van Rossum
D. Niene Stom
Which of the following is an advantage of Python?
A. It compiles to machine code
B. It enforces strict typing
C. It has a large standard library
D. It requires extensive memory management
What is the role of the Python interpreter?
A. To convert Python code to assembly language
B. To manage memory allocation
C. To execute Python code line by line
D. To compile Python code into bytecode

Join The Discussion