Level 1 – Beginner (Basic understanding and application) – 25 Questions
1. Write a Python program to check if a number is positive, negative, or zero using if
else.
2. Accept an age from the user and check if the person is eligible to vote (age >= 18).
3. Write a Python program to find the maximum of two numbers using an if-else
statement.
4. Write a program to check if a number is even or odd.
5. Accept a number from the user and print whether it is divisible by 5 and 11 or not.
6. Write a program that accepts marks and prints "Pass" if marks are >= 40, else prints
"Fail".
7. Write a Python program to check if a year is leap year or not using nested-if.
8. Write a Python program to check whether a character is a vowel or consonant.
9. Write a program to input three numbers and find the greatest using nested-if.
10. Write a Python program to evaluate this expression: ((a + b) * c) / d with user inputs.
11. Evaluate and display the result of 3 + 5 * 2 // 4 - 1. Explain the order of execution.
12. Write a program to calculate the value of an expression containing float values like
3.5 + 4.2 * 2.
13. Write a program to demonstrate float division and integer division difference using /
and //.
14. Accept two float numbers and display their sum, difference, product and quotient.
15. Write a program to show what happens when you divide by a float value close to
zero.
16. Accept a floating-point number and print it with 2 decimal places.
17. Write a program to compare two float values entered by the user.
18. Write a Python program to print numbers from 1 to 10 using a while loop.
19. Write a Python program to print the first 10 even numbers using a for loop.
20. Write a program to find the sum of first n natural numbers using a loop.
21. Write a program to display the multiplication table of a given number using a for
loop.
22. Write a Python program to count down from 10 to 1 using a while loop.
23. Write a program to print the square of numbers from 1 to 5 using a for loop.
24. Write a program that uses a break statement to stop the loop when a number becomes
greater than 5.
25. Write a program that skips the number 3 in a loop from 1 to 5 using-
Level 2 – Moderate (Intermediate problem-solving) – 30 Questions
1. Write a program to input three numbers and check whether they form a valid triangle.
2. Accept the marks of 5 subjects and calculate the grade based on percentage using if-
elif-else: A: >=90, B: 80–89, C: 70–79, D: 60–69, F: <60
3. Write a program to check whether a character is uppercase, lowercase, digit, or
special character.
4. Accept a year and check if it is a century leap year.
5. Write a program to determine whether a point (x, y) lies in Quadrant I, II, III, IV, or
on an axis.
6. Write a Python program to check whether a number is prime using conditional logic
(not loops).
7. Create a menu-driven program using if-elif-else for: Add, 2. Subtract, 3. Multiply, 4.
Divide two numbers.
8. Write a Python program that accepts a password and checks for length (>=8),
uppercase, and digit using nested conditions.
9. Write a Python program to accept two dates (dd, mm, yyyy) and check which is
earlier.
10. Implement a mini ATM interface that validates a PIN, and allows withdrawal if
balance is sufficient.
11. Write a program to evaluate the expression:
(a2+b2)/(2ab+1)(a^2 + b^2) / (2ab + 1)(a2+b2)/(2ab+1)
with float inputs and proper rounding.
12. Accept a float value for temperature in Celsius and convert it to Fahrenheit and
Kelvin.
13. Write a program to simulate a simple EMI calculator using float arithmetic.
14. Accept principal, rate, and time and compute compound interest using float
representation.
15. Accept float values and demonstrate the difference between round(), [Link](), and
[Link]().
16. Accept a float number and display the scientific notation using formatting.
17. Accept a floating-point number and check if it is close to zero, but not exactly zero.
18. Write a program to compare two float numbers with a tolerance (epsilon) to handle
precision issues.
19. Show how multiple arithmetic operations are evaluated by evaluating a complex float
expression and printing each step.
20. Accept time in hours and minutes and convert it to decimal hours using float
division.
21. Write a program to reverse a number using a while loop.
22. Accept a number and check whether it is a palindrome using loops.
23. Write a program to print the Fibonacci series up to n terms using a for loop.
24. Accept a number and check whether it is a perfect number using a loop.
25. Write a program to print all prime numbers between 10 and 50 using a for loop and
continue.
26. Write a program to display the factorial of a given number using a while loop.
27. Write a program to find the LCM and HCF of two numbers using loops.
28. Write a program using nested loops to display this pattern:
1
12
123
...
up to n
29. Use a break statement to exit a loop early when a specific condition is met in user
input.
30. Write a number-guessing game using a while loop. The program should:
Generate a random number.
Allow the user to guess until correct.
Give hints (Too high/Too low).
Level 3 – Expert (Advanced application and logic) – 10 Questions
1. Write a Python program that accepts a user's age, monthly income, credit score, and
existing debt amount. Use nested if-elif-else statements to determine whether
the user is eligible for a loan based on the following conditions: Age
must be ≥ 21.
Credit score > 700 and low debt → eligible.
Credit score between 600–700 → eligible only if income > ₹50,000.
Otherwise, display appropriate rejection reasons.
2. Write a Python program that accepts a string expression like "3.5 * (2 + 4.1) / 1.5" and
evaluates it without using eval(). Use loops and conditionals to handle float operations,
parentheses, and operator precedence.
3. Create a Python function that accepts a floating-point number and rounds it to the
nearest 0.05. For example:
4. Write a program that accepts an integer and checks whether the number is:
A prime number, A perfect number, An Armstrong number, A palindrome number
Use separate functions and loops for each check, and display all applicable
classifications.
5. Accept an odd number n from the user and print a diamond pattern of * using nested
loops. For example, for n = 5, the output should be:
**
***
**
6. Write a function compare_floats(a, b, epsilon) that compares two floating-point numbers.
It should return "Equal", "Greater", or "Smaller" depending on the values, using a custom
epsilon for precision (e.g., 0.00001). Test it with values like 0.1 + 0.2 and 0.3.
7. Accept a floating-point number from the user and print its first 10 multiples. Display each
multiple in: Standard float format
Scientific notation (e.g., 3.20e+01)
Use formatted strings and a loop.
8. Create a menu-driven calculator using if-elif and loops with the following options: Add,
Subtract, Multiply, Divide (with float safety), Power and Exit. Maintain a history of
operations and display it when the user exits.
9. Create a number guessing game with 3 difficulty levels: Easy (1–10), Medium (1–50),
Hard (1–100). Allow 3 attempts per game. Give hints ("Too High" / "Too Low") and use
nested loops, break, and continue statements.
10. Write a program that accepts start time and end time in HH:MM format. Convert both
to float hours, calculate the total duration in hours, and handle cases where the end time
is on the next day (e.g., 23:30 to 01:15).
Level 4 – Competitive Coding – Beginner (Entry-level platform problems) – 25
Questions.
1. Write a Python program that accepts an integer and prints "Even" if it's even,
otherwise prints "Odd".
2. Write a program to accept three integers and print the largest among them.
3. Write a program to check whether a given year is a leap year. Print "Leap
Year" or "Not a Leap Year".
4. Accept the percentage marks of a student and print the grade
as per the following rules: ≥90 → A, 80–89 → B, 70–79 → C, 60–
69 → D, <60 → F.
5. Write a program that takes the lengths of three sides and checks whether they
can form a triangle. Print "Valid Triangle" or "Invalid Triangle".
6. Write a program that takes a number and prints "Fizz" if divisible by 3, "Buzz"
if divisible by 5, "FizzBuzz" if divisible by both 3 and 5, otherwise print the
number itself.
7. Write a program that accepts temperature in Celsius and converts it to
Fahrenheit using the formula: F = C * 9/5 + 32.
8. Write a program to input weight (in kg) and height (in meters),
calculate BMI, and print: "Underweight" if BMI < 18.5, "Normal"
if BMI is 18.5–24.9, "Overweight" if BMI ≥ 25.
9. Write a program to input principal, rate, and time, and compute the simple
interest using the formula: SI = (P * R * T) / 100.
[Link] a program to input a single character and determine whether it is an
uppercase alphabet, lowercase alphabet, digit, or special character.
[Link] a program to accept an integer N and print all numbers from 1 to N.
[Link] an integer and calculate its factorial using a loop.
[Link] a number N and print the sum of the first N natural numbers.
[Link] a program to input a number and print its multiplication table up to 10.
[Link] a program to input a number and print its reverse (e.g.,
123 → 321).
[Link] a program to check whether a given number is a palindrome (same
forward and backward).
[Link] a program to input a number and count how many digits it has.
[Link] a program to input a number and calculate the sum of its digits.
[Link] a program to print the first N terms of the Fibonacci series.
[Link] a program to check whether a given number is a prime number.
[Link] a program that takes an integer n and prints a right-angled triangle
pattern using * up to n rows.
[Link] a number n and print an n x n square made of stars (*).
[Link] a program that accepts a list of integers and stops reading input when the
first even number is found. Print "Even Found".
[Link] a program to print all numbers from 1 to N, skipping those that are
divisible by 3 using continue.
[Link] a program using nested loops to print a sum table. Each row should print
the sum of a fixed number with numbers from 1 to 5 (e.g., 1+1=2, 1+2=3, ...,
5+5=10).
Level 5 – Competitive Coding – Moderate – 15 Questions
1. Write a program to input three numbers and print them in ascending order without using
built-in sort functions.
2. Create a menu-driven program using if-elif-else that allows a user to perform addition,
subtraction, multiplication, or division on two float numbers.
3. Accept a float value representing a score (0–10) and assign a rating:
9.0–10.0: Outstanding
8.0–8.9: Excellent
6.0–7.9: Good
<6.0: Needs Improvement
Ensure correct use of float comparison and elif.
4. Write a program that takes a 4-digit number and checks whether the sum of the first two
digits equals the sum of the last two digits.
5. Write a program that takes an angle (in degrees) and prints whether it is an acute, right,
obtuse, or straight angle.
6. Write a program that checks whether a given year is a leap year and also a multiple of
100 or 400, using nested if-else.
7. Write a program to compute the electricity bill based on the following rates:
First 100 units: ₹1.5/unit
Next 100 units: ₹2.5/unit
Beyond 200 units: ₹4/unit
Add a fixed charge of ₹50 and round the total to 2 decimal places.
8. Write a program to print all numbers from 1 to N which are divisible by 3 or 5 but not
both.
9. Write a program that reads numbers continuously from the user and prints their sum, but
stops if the user enters a negative number.
10. Write a program to count the number of digits, vowels, consonants, and special characters
in a given string using loops.
11. Accept a number and print its binary representation using a while loop (without using
built-in bin() function).
12. Write a program to find the sum of the factorials of the digits of a
number (e.g., for 145 → 1! + 4! + 5!).
13. Print the following pattern using nested loops for a given n:
1
12
123
14. Write a program that prints only the prime numbers between 1 and N using a for loop and
a nested while loop.
15. Create a number-guessing game where the program generates a random number between
1 to 50, and the user is allowed 5 chances to guess it. Use break and continue to control
the loop flow, and give hints like "Too High" or "Too Low"
Level 6 – Competitive Coding – Expert – 10 Questions.
1. Use Case:
A smart city wants to simulate a traffic light controller that cycles
through Green → Yellow → Red using time intervals. It should
automatically switch states based on elapsed time, and break the loop
after a certain number of cycles.
Problem Statement: Write a program that simulates a traffic light system:
Green for 60 seconds
Yellow for 5 seconds
Red for 55 seconds
Cycle repeats for a given number of times (n). Use a loop and if-elif to display:
2. Use Case:
In an organization, detecting absentee trends early helps prevent productivity loss.
Problem Statement: You are given an employee’s attendance record for 30 days as a
string of 'P' (Present), 'A' (Absent), and 'L' (Late).
Write a program to analyze the attendance and determine:
If the employee was ever absent 3 days in a row → "Alert: Pattern
Detected"
Total number of present, absent, and late days Use a loop and if
statements to check conditions.
3. Given an integer n, print numbers from 1 to n in a zigzag pattern of k rows using nested
loops.
Example for n = 10, k = 3:
1 5 9
2 4 6 8 10
3 7
4. Given a list of tokens representing an RPN expression (e.g., ["2", "1", "+", "3", "*"]),
evaluate it. Support float values and operators +, -, *, /.
5. Given a circular array of integers, for each element, find the next greater element. If not
found, return -1. Use loops and conditionals efficiently.
6. Given a string, return the length of the longest substring without repeating characters.
Use nested loops and conditional checks.
7. Use Case: A warehouse management system must flag items that are nearing expiry.
Problem Statement: Given a list of n products, each with: Name (string), Days
until expiry (integer)
Write a program using a loop and if-else to: Flag items with ≤ 5 days to
expiry → "Urgent"
Items between 6–30 days → "Soon"
Otherwise → "Safe"
Sample Output:
yaml
CopyEdit
Item: Milk, Status: Urgent
Item: Shampoo, Status: Safe
Item: Bread, Status: Soon
8. Given a square matrix, return the sum of both diagonals. If a cell belongs to both
diagonals (i.e., center of odd-length matrix), count it once. Use nested loops and if.
9. A security application needs to evaluate user-entered passwords for strength based on
certain rules.
Problem Statement: Write a program to input n passwords and evaluate their strength
using if-else and loops. A strong password must:
Be at least 8 characters long
Contain at least one uppercase letter
Contain at least one lowercase letter
Contain at least one digit
Contain at least one special character (@, #, $, %, &, *)
Print "Strong" or "Weak" for each [Link].
10. Use Case; An online payment platform wants to implement a bill-splitting system for groups. The
total should be divided among friends, include a service charge and optional tip, and round up to
the nearest ₹0.50 for fairness.
Problem Statement:
Given; Total bill (float), Number of people, Tip percentage
Calculate the amount each person should pay after adding the tip and rounding up to the nearest
0.50.