Class 11 Python Programs: Practice with Test Cases
Write the Python programs CBSE Class 11 Computer Science (083) asks for, chapter by chapter. Your code runs in your own browser and is checked against sample tests you can see and hidden tests you cannot, with marks for every test that passes. You can try these without an account.
Here: 10 programs, one from each chapter. The full Class 11 Python Lab has 65, in three formats: write the program, complete the program, and fix the errors.
Expressions and Input/Output
Reading values with input(), converting them with int() and float(), arithmetic operators and expressions, and printing results in an exact format.
Conditional Statements
Decisions with if, if-else and if-elif-else: grades, largest of numbers, divisibility, slabs and other rules a program must check in order.
Iterative Statements: Number Programs
for and while loops on numbers: factorial, prime numbers, digits of a number, palindromes, Armstrong and perfect numbers, GCD and LCM.
Iterative Statements: Series
Loops that add up the terms of a series such as 1 + x + x² + ... or alternating series, keeping a running sum and the current term.
Iterative Statements: Patterns
Nested loops that print star, number and alphabet patterns row by row.
Strings
Traversing a string, indexing and slicing, and string methods: counting characters, palindromes, changing case, words and replacements.
Lists
Creating and traversing lists, list methods, linear search, frequency of elements, and simple list processing.
Tuples
Tuples as read-only sequences: traversal, searching, minimum, maximum and mean, and nested tuples.
Dictionary
Key-value data with dictionaries: counting frequencies, looking up and updating values, and traversing items.
Python Modules
Using the math, random and statistics modules: math.pi, sqrt, floor and ceil, and mean, median and mode.
How it works
- Open a program and read the sample tests.
- Write your Python code in the editor.
- Run Code to check it on the sample tests.
- Submit Answer to be marked on hidden tests, then compare with the model answer.
Practise all 65 Class 11 programs
With a KV Coders account (Class 11 Computer Science) you get the complete Class 11 Python Lab: every program in every chapter, your best score on each one, and your progress in each chapter.
Also for Class 11 Computer Science: previous year questions by chapter · chapter notes · online Python IDE. Class 12? Try the Class 12 Python Lab demo.