print the numbers from 1 to 100 in python

To print the numbers from 1 to 100 in Python, you can use the range() function in a for loop and print() function to display each number on a new line. Here's the code:

main.py
for num in range(1, 101):
    print(num)
41 chars
3 lines

This code initializes a for loop with a loop variable num that takes values from 1 to 100. The range() function generates a sequence of numbers from the starting value 1 to the ending value 101 (excluding 101) in increments of 1. The loop body simply prints each number from 1 to 100 on a new line with the print() function.

gistlibby LogSnag