pyPython Practice LabFrom first print to final round
TOPIC 03 OF 18

Loops and Number Problems Python practice problems

Build loop confidence with counters, accumulators, digit logic, primes, and classic sequences.

20 exercises8+ conceptsBeginner → interview context
Start this topic
WHAT YOU WILL PRACTISE

Core concepts

Sum the first n integersCalculate a factorialPrint a multiplication tableCount digits in an integerReverse an integerCheck a numeric palindromeTest primalityList primes up to n
REUSABLE THINKING

Problem-solving patterns

  • Initialize → repeat → update → finish
INTERVIEW SIGNALS

Reported company tags

InfosysCapgeminiTCSAmazonMicrosoftMeta
Community-reported tags are guidance, not guarantees.
ORDERED PRACTICE

All 20 problems in this topic

Work from top to bottom to build the concept gradually.

  1. #041
    Sum the first n integers: Weekly counters

    Add counters numbered 1 through 10 for a simple progress total.

    BeginnerPremium
  2. #042
    Sum the first n integers: Empty range

    Confirm that summing through zero leaves the initial total unchanged.

    BeginnerPremium
  3. #043
    Calculate a factorial: Arrangement count

    Find the number of arrangements of six distinct display items.

    BeginnerPremium
  4. #044
    Calculate a factorial: Zero factorial

    Verify the factorial definition for an empty arrangement.

    BeginnerPremium
  5. #045
    Print a multiplication table: Practice table

    Generate the standard ten-line multiplication table for 7.

    BeginnerPremium
  6. #046
    Print a multiplication table: Negative table

    Observe the same loop with a negative base number.

    BeginnerPremium
  7. #047
    Count digits in an integer: Large invoice number

    Count how many digits appear in an invoice identifier.

    BeginnerPremium
  8. #048
    Count digits in an integer: Signed single digit

    Ignore the minus sign when counting a negative single-digit value.

    BeginnerPremium
  9. #049
    Reverse an integer: Reverse an access code

    Reverse the digits of a numeric access code.

    BeginnerPremium
  10. #050
    Reverse an integer: Negative value with zeros

    Reverse a negative number and naturally discard leading zeros in the result.

    BeginnerPremium
  11. #051
    Check a numeric palindrome: Symmetric code

    Check whether a five-digit gate code reads the same backward.

    BeginnerPremium
  12. #052
    Check a numeric palindrome: Ordinary number

    Reject a number whose reverse is different.

    BeginnerPremium
  13. #053
    Test primality: Prime identifier

    Check whether 29 can be used as a prime-sized hash table example.

    BeginnerPremium
  14. #054
    Test primality: Small edge case

    Remember that 1 is neither prime nor composite.

    BeginnerPremium
  15. #055
    List primes up to n: Small prime catalog

    List all prime numbers that do not exceed 20.

    BeginnerPremium
  16. #056
    List primes up to n: Boundary prime

    Include the upper bound when it is itself prime.

    BeginnerPremium
  17. #057
    Generate Fibonacci terms: Ten-term sequence

    Generate ten Fibonacci terms for a learning dashboard.

    BeginnerPremium
  18. #058
    Generate Fibonacci terms: Single-term edge case

    Return only the starting value when one term is requested.

    BeginnerPremium
  19. #059
    Find GCD and LCM: Align maintenance cycles

    Find when 18-day and 24-day maintenance cycles align, along with their GCD.

    BeginnerPremium
  20. #060
    Find GCD and LCM: Coprime values

    Calculate GCD and LCM for values that share no factor above 1.

    BeginnerPremium