Question: User: write a python loop
**Python Loop Basics**
1. **Problem Statement**
- How to write a loop in Python to repeat actions.
2. **For Loop Syntax**
- The for loop iterates over a sequence.
- Syntax: for item in sequence:\n # code block
3. **While Loop Syntax**
- The while loop repeats as long as a condition is true.
- Syntax: while condition:\n # code block
4. **Example For Loop**
- Looping through numbers 0 to 4:
- for i in range(5):\n print(i)
5. **Example While Loop**
- Printing numbers 0 to 4:
- i = 0\nwhile i < 5:\n print(i)\n i += 1
**Summary:**
- Use for loops to iterate over sequences.
- Use while loops for conditional repetition.
- Remember to update variables in while loops to avoid infinite loops.