Here is an example of a for loop in Python:

# Define a list of numbers
numbers = [1, 2, 3, 4, 5]

# Iterate over the list using a for loop
for number in numbers:
    # Print each number multiplied by 2
    print(number * 2)

This loop will iterate over each number in the numbers list and print it multiplied by 2. The output will be:

2
4
6
8
10
write a python for loop

原文地址: https://www.cveoy.top/t/topic/bcVF 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录