Python Code to Print Numbers 1 to 100
Here is the Python code to print numbers from 1 to 100:
for i in range(1, 101):
print(i)
In the above code, we have used a 'for' loop to iterate from 1 to 100. The 'range()' function generates a sequence of numbers starting from the first argument (1) and ending at the second argument (101 - 1 = 100).
Inside the loop, we have used the 'print()' function to print each number on a new line.
原文地址: https://www.cveoy.top/t/topic/lEA8 著作权归作者所有。请勿转载和采集!