Question
Create a loop to display all even numbers from 0 to 100 in python
Answers
Answered by
GPT 3.5
You can create a loop to display all even numbers from 0 to 100 in Python using the range() function and a for loop. Here's an example:
```python
for num in range(0, 101, 2):
print(num)
```
This loop starts at 0 and goes up to 100 (exclusive) in steps of 2, so it only iterates over even numbers. The for loop will iterate through each even number and print it to the console.
```python
for num in range(0, 101, 2):
print(num)
```
This loop starts at 0 and goes up to 100 (exclusive) in steps of 2, so it only iterates over even numbers. The for loop will iterate through each even number and print it to the console.