Phase 2 - Level 1: Basic Looping
Master basic loops - for and while loops for iteration.
14 programs · open one, then the next
Start with Print Numbers from 1 to 10- 01Print Numbers from 1 to 10BeginnerPrint one through ten with a for loop. Beginners trace range boundaries, repeated print calls, and the excluded stopping value without reading user input.Open example →py# Print numbers 1 to 10 for i in range(1, 11): print(i)
- 02Print All Even Numbers Between 1 and 100BeginnerGenerate even numbers from two through one hundred in Python. Students use a range step of two and learn why the stop must be beyond the final desired value.Open example →py# Print even numbers from 1 to 100 for i in range(2, 101, 2): print(i)
- 03Sum of First N Natural NumbersBeginnerAdd the first n natural numbers using a Python accumulator. Beginners trace a running total, the inclusive upper bound, and what an empty loop leaves behind.Open example →py# Take n as input n = int(input("Enter n: ")) # Calculate sum
- 04Print the Factorial of a Given NumberBeginnerCompute factorial with a multiplication loop. Students follow the initial value one, included factors, zero factorial, and the need to reject negative inputs.Open example →py# Take n as input n = int(input("Enter n: ")) # Calculate factorial
- 05Print All Odd Numbers Between 1 and 100BeginnerList odd numbers below one hundred using range. Beginners compare start, stop, and step and check the last printed value without an extra parity condition.Open example →py# Print odd numbers from 1 to 100 for i in range(1, 101, 2): print(i)
- 06Print Numbers from 10 Down to 1BeginnerCount backward from ten to one with Python range. Students trace a negative step, an excluded lower stop, and why the direction of a range must match its step.Open example →py# Print numbers 10 to 1 for i in range(10, 0, -1): print(i)
- 07Print Multiplication TableBeginnerBuild a ten-row multiplication table from an entered integer. Students use range, a temporary result, and formatted output that labels every multiplication.Open example →py# Take n as input n = int(input("Enter a number: ")) # Print multiplication table
- 08Sum of All Even Numbers Up to NBeginnerSum even integers no greater than an entered limit in Python. Beginners trace a stepped range, a zero accumulator, and limits that may be odd or below two.Open example →py# Take n as input n = int(input("Enter n: ")) # Calculate sum of even numbers
- 09Sum of All Odd Numbers Up to NBeginnerAdd odd integers from one up to a supplied limit with Python. Students trace a two-step range and compare an accumulated total with printing individual numbers.Open example →py# Take n as input n = int(input("Enter n: ")) # Calculate sum of odd numbers
- 10Product of Digits with a Basic While LoopBeginnerMultiply a number's digits using a basic while loop. Students trace abs, remainder, floor division, and the zero case that needs a separate initial value.Open example →py# Take number num = int(input("Enter a number: ")) # Calculate product of digits
- 11Count Numbers Divisible by 3BeginnerCount integers divisible by three between one and n with Python. Students separate a match counter from a total and use modulo inside a bounded for loop.Open example →py# Take n as input n = int(input("Enter n: ")) # Count divisible by 3
- 12Print Multiples of 5 Up to NBeginnerPrint multiples of five up to a chosen limit in Python. Beginners follow a stepped range and learn how end changes spacing while a final print ends the line.Open example →py# Take n as input n = int(input("Enter n: ")) # Print multiples of 5
- 13Sum of Squares Up to NBeginnerAccumulate the squares of one through n using Python. Students distinguish squaring each term from squaring a total and trace a running sum through the loop.Open example →py# Take n as input n = int(input("Enter n: ")) # Calculate sum of squares
- 14Print Alternating NumbersBeginnerPrint positive odd values and negative even values through n. Students trace parity-based output choices without changing the loop's ascending control value.Open example →py# Take n as input n = int(input("Enter n: ")) # Print alternating