Here's the code to print all even numbers within first 100 numbers:
main.py54 chars4 lines
Explanation:
range(1, 101)
generates numbers from 1 to 100 (inclusive).if i % 2 == 0
checks if a number is even or not by dividing it by 2 and checking for remainder. If the remainder is 0, then the number is even.print(i)
prints the even number.gistlibby LogSnag