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.py41 chars3 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