CBSE 2026-27 · Class 11 · Code 083

Important CS Programs

Master your practical exams with our curated list of essential Python programs for Class 11 Computer Science. Click on any program to view the code, copy it, or run it instantly.

In each topic the programs go from Easy to Hard. A CBSE tag shows the paper or practical list a program comes from; Rare marks less common programs that are still in the syllabus.

100 programs in 8 topics

PYTHON BASICS, INPUT/OUTPUT & OPERATORS 11 programs

  1. input() reads text typed by the user; print() shows it.

  2. input() always gives text, so int() converts it to a number before adding.

    Easy
  3. SI = P x R x T / 100. float() allows decimal values.

    Easy
  4. Use arithmetic operators to calculate area and perimeter.

    Easy
  5. Two ways: with a third variable, and Python's a, b = b, a.

    Easy
  6. / gives a decimal, // the whole-number quotient, % the remainder and ** the power.

    Easy
  7. Python converts int to float by itself (implicit); int(), float() and str() convert on request (explicit).

    Easy
  8. x += 5 means x = x + 5. is checks if two names point to the same object; in checks membership.

  9. not is done first, then and, then or.

  10. Expressions from CBSE papers. ** is done first (right to left), then * / // %, then + -.

  11. A syntax error stops the program before it runs; a runtime error stops it while running; a logical error gives a wrong answer.

CONDITIONAL STATEMENTS (IF, ELIF, ELSE) 11 programs

  1. A number is even if the remainder after dividing by 2 is 0.

    Easy
  2. Input two numbers and display the larger and the smaller number.

  3. The absolute value is the number without its minus sign.

    Easy
  4. Check if one number divides another exactly (remainder 0).

    Easy
  5. Input three numbers and display the largest and the smallest.

  6. Arrange three numbers in ascending order using only if statements.

    Medium
  7. An if-elif-else ladder: only the first true condition runs.

    Medium
  8. Divisible by 4 but not by 100, or divisible by 400.

    Medium
  9. Choose the operation with if-elif and handle division by zero.

    Medium
  10. Check whether a character is an uppercase letter, lowercase letter, digit or special character.

    Hard
  11. Each side must be smaller than the sum of the other two.

    Hard Rare

LOOPS (FOR, WHILE, NESTED) 21 programs

  1. range(start, stop, step): stop is not included.

  2. Print the table of a number from 1 to 10.

    Easy
  3. Add 1 + 2 + ... + N with a loop.

    Easy
  4. n! = 1 x 2 x ... x n, and 0! = 1.

    Easy
  5. Error-finding question (the paper puts this loop inside a function EvenOdd()). Fixes: closing bracket, % instead of /, and indentation of the else part.

  6. Each term is the sum of the two terms before it: 0 1 1 2 3 5 ...

  7. A prime has exactly two factors: 1 and itself. 1 is neither prime nor composite.

  8. Error-finding question. Fixes: closing bracket, range starts at 1 (no division by zero), == instead of =, and indentation.

  9. % 10 gives the last digit and // 10 removes it.

    Medium
  10. Palindrome: same when reversed. Armstrong: sum of digits^count = number. Perfect: sum of factors (except itself) = number.

  11. GCD by repeated remainders (Euclid); LCM = a x b / GCD.

  12. break leaves the loop; continue skips to the next round.

    Medium
  13. Nested loops: the outer loop is the row, the inner loop prints the stars.

  14. Each row prints 1 up to a number that gets smaller.

  15. chr(65) is "A"; add j to get the next letters.

  16. Input x and n and add the powers of x.

  17. The sign changes every term: (-1)^i gives + - + - ...

  18. Each term is x to the power i, divided by i.

  19. Keep a running factorial so each term is x^i / i!.

  20. Trace the loop step by step: new % 2 is 0 (False) when new is even. (In the paper this loop is inside a function.)

  21. random.randint picks a secret number; a while loop gives hints until it is guessed.

    Hard Rare

STRINGS 14 programs

  1. Positions start at 0; negative positions count from the end.

    Easy
  2. Concatenation, repetition, membership and slicing [start:stop:step].

    Easy
  3. These methods return a new string; the original is not changed.

  4. They return True or False.

  5. find() gives -1 if not found; index() gives an error instead.

  6. split() breaks a string into a list; join() joins a list into a string.

  7. With a negative step the slice moves right to left, starting at the first number.

  8. Count and display the vowels, consonants, uppercase and lowercase characters in a string.

  9. Check if a string is a palindrome, then change uppercase to lowercase and lowercase to uppercase.

  10. split() gives the words; len() of the list counts them.

    Medium
  11. Palindrome words print their letters with *, others with #.

  12. Digits become digit+1, a capital letter is replaced by the next character, anything else becomes *.

  13. Uppercase letters become lowercase, digits are doubled, the rest become #.

  14. Build a new string with only the characters that are not vowels.

    Hard Rare

LISTS 15 programs

  1. A list keeps items in order; it can be changed (mutable).

    Easy
  2. Concatenation, repetition, membership and slicing work like strings.

    Easy
  3. Methods that add and remove items.

  4. Find the largest, smallest and average of the numbers in a list.

  5. sort() changes the list; sorted() returns a new list and keeps the original.

  6. Trace each statement in order.

  7. Input a list and search for a given element.

  8. count() tells how many times a value appears.

  9. Swap L[0] with L[1], L[2] with L[3], and so on.

  10. Error-finding question. Fixes: matching quotes, range(L-1, -1, -1), the colon, and print in lowercase.

  11. A list inside a list: L[i][j] is row i, column j.

    Medium
  12. Split a string into a list, then slice it.

  13. Uppercase letters reverse the list, new characters are added, repeated ones remove the last item. (In the paper this loop is inside a function.)

  14. Find the second largest without sorting.

    Hard Rare
  15. Keep only the first copy of each value, in the same order.

    Hard Rare

TUPLES 8 programs

  1. A tuple is like a list but cannot be changed (immutable). A one-item tuple needs a comma.

    Easy
  2. Changing an item gives TypeError, but you can build a new tuple.

  3. Built-in functions and methods that work on tuples.

    Easy
  4. Unpack a tuple into variables in one line.

    Medium
  5. t += ... makes a NEW tuple; other names still point to the old one.

  6. Find the largest and smallest number in a tuple, and the mean.

  7. Linear search for an element and count its frequency.

  8. Change a tuple by turning it into a list, editing, then back into a tuple.

DICTIONARIES 12 programs

  1. A dictionary stores key: value pairs. Use the key to get or change a value.

    Easy
  2. A for loop over a dictionary gives its keys.

  3. in checks keys only; get() returns a default instead of an error.

  4. pop(key) returns the value; del removes; popitem() removes the last pair; clear() empties.

  5. More dictionary methods from the syllabus.

  6. Count how many times each character appears in a string.

    Medium
  7. Create a dictionary of employees and their salaries and access them.

    Medium
  8. A dictionary with roll number, name and marks of n students; display the names of those scoring above 75.

  9. Store only the words whose length is a multiple of 4.

  10. L.pop() removes from the end of the list each time.

  11. Each value is a tuple of two salaries; keep names whose average is above 80000.

  12. max(D, key=D.get) gives the key with the largest value; sorted() sorts the keys.

    Hard Rare

PYTHON MODULES (MATH, RANDOM, STATISTICS) 8 programs

  1. import math, then use math.name.

    Easy
  2. from math import sqrt lets you write sqrt() without math.

    Easy
  3. The angle must be in radians: math.radians() converts degrees.

    Easy
  4. mode gives the most common value.

  5. random() gives 0 to <1; randint(a, b) includes b; randrange(a, b) does not include b.

    Medium
  6. randrange(K) gives 0 to K-1. Work out which values each round can give.

  7. randint(a, b) includes both a and b.

  8. Make a 6-digit one-time password from random digits.

    Hard Rare