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 numbers from 1 to 10 using a loop.Open example →py# Print numbers 1 to 10 for i in range(1, 11): print(i)
- 02Print All Even Numbers Between 1 and 100BeginnerPrint all even numbers from 1 to 100.Open example →py# Print even numbers from 1 to 100 for i in range(2, 101, 2): print(i)
- 03Sum of First N Natural NumbersBeginnerPrint the sum of first n natural numbers.Open example →py# Take n as input n = int(input("Enter n: ")) # Calculate sum
- 04Print the Factorial of a Given NumberBeginnerCalculate and print the factorial of a number.Open example →py# Take n as input n = int(input("Enter n: ")) # Calculate factorial
- 05Print All Odd Numbers Between 1 and 100BeginnerPrint all odd numbers from 1 to 100.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 1BeginnerPrint numbers from 10 down to 1.Open example →py# Print numbers 10 to 1 for i in range(10, 0, -1): print(i)
- 07Print Multiplication TableBeginnerPrint the table of a given number (n × 1 to n × 10).Open example →py# Take n as input n = int(input("Enter a number: ")) # Print multiplication table
- 08Sum of All Even Numbers Up to NBeginnerPrint the sum of all even numbers up to n.Open example →py# Take n as input n = int(input("Enter n: ")) # Calculate sum of even numbers
- 09Sum of All Odd Numbers Up to NBeginnerPrint the sum of all odd numbers up to n.Open example →py# Take n as input n = int(input("Enter n: ")) # Calculate sum of odd numbers
- 10Product of DigitsBeginnerPrint the product of digits of a given number.Open example →py# Take number num = int(input("Enter a number: ")) # Calculate product of digits
- 11Count Numbers Divisible by 3BeginnerCount numbers from 1 to n that are divisible by 3.Open example →py# Take n as input n = int(input("Enter n: ")) # Count divisible by 3
- 12Print Multiples of 5 Up to NBeginnerPrint all multiples of 5 from 5 to n.Open example →py# Take n as input n = int(input("Enter n: ")) # Print multiples of 5
- 13Sum of Squares Up to NBeginnerCalculate sum of squares from 1² to n².Open example →py# Take n as input n = int(input("Enter n: ")) # Calculate sum of squares
- 14Print Alternating NumbersBeginnerPrint numbers 1 to n with alternating signs.Open example →py# Take n as input n = int(input("Enter n: ")) # Print alternating