What is the main difference between a while loop and a for loop?
A while loop repeatedly executes a section of code as long as its condition remains true, while a for loop iterates over a sequence or range of values, executing its block of code for each value in the sequence. 
The key difference between the two is their usage, where a while loop is used when you are uncertain about the number of times a block of code needs to be repeated but want to keep repeating it as long as a certain condition is fulfilled. On the other hand, a for loop is used when you have a specific sequence or range of values, and the number of times you want the loop to iterate is predetermined.
Complete the following task based on the instruction and optional input provided.### Instruction:
What is the main difference between a while loop and a for loop?

### Output:
A while loop repeatedly executes a section of code as long as its condition remains true, while a for loop iterates over a sequence or range of values, executing its block of code for each value in the sequence. 
The key difference between the two is their usage, where a while loop is used when you are uncertain about the number of times a block of code needs to be repeated but want to keep repeating it as long as a certain condition is fulfilled. On the other hand, a for loop is used when you have a specific sequence or range of values, and the number of times you want the loop to iterate is predetermined.