{"id":1765,"date":"2025-07-25T12:17:16","date_gmt":"2025-07-25T12:17:16","guid":{"rendered":"https:\/\/itxperts.co.in\/blog\/?p=1765"},"modified":"2025-07-25T12:39:55","modified_gmt":"2025-07-25T12:39:55","slug":"python-programs-class-11-12-cbse-practical-file","status":"publish","type":"post","link":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/","title":{"rendered":"100+ Python Programs for Class 11 &amp; 12 (CBSE) \u2013 Basics to Projects with Code"},"content":{"rendered":"\n<p>Are you a Class 11 or 12 student looking for complete Python programs for your CBSE practical file? This post brings you 100+ well-structured Python programs with output \u2014 covering everything from basics to advanced concepts like file handling, data structures, functions, Pandas, and mini projects. Whether you&#8217;re preparing for school exams, board practicals, or just want to practice and improve, these programs are organized topic-wise to help you learn Python step by step.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1. Hello World program<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"Hello, World!\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Display your name, age, class<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>name = \"Vikram\"\nage = 16\nstudent_class = \"11th\"\nprint(\"Name:\", name)\nprint(\"Age:\", age)\nprint(\"Class:\", student_class)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Add two numbers<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>a = 10\nb = 20\nsum = a + b\nprint(\"Sum:\", sum)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Find the square and cube of a number<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>num = 5\nsquare = num ** 2\ncube = num ** 3\nprint(\"Square:\", square)\nprint(\"Cube:\", cube)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Calculate area of circle, rectangle, triangle<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import math\nradius = 7\ncircle_area = math.pi * radius ** 2\nprint(\"Area of Circle:\", circle_area)\nlength = 5\nwidth = 3\nrectangle_area = length * width\nprint(\"Area of Rectangle:\", rectangle_area)\nbase = 10\nheight = 6\ntriangle_area = 0.5 * base * height\nprint(\"Area of Triangle:\", triangle_area)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Convert Celsius to Fahrenheit<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>celsius = 37\nfahrenheit = (celsius * 9\/5) + 32\nprint(\"Fahrenheit:\", fahrenheit)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Swap two numbers<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>a = 10\nb = 20\na, b = b, a\nprint(\"a =\", a)\nprint(\"b =\", b)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Find the largest of three numbers<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>a = 15\nb = 25\nc = 10\nif a &gt;= b and a &gt;= c:\n    largest = a\nelif b &gt;= a and b &gt;= c:\n    largest = b\nelse:\n    largest = c\nprint(\"Largest number is:\", largest)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. Check if a number is even or odd<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>num = 9\nif num % 2 == 0:\n    print(\"Even\")\nelse:\n    print(\"Odd\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. Find ASCII value of a character<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>char = 'A'\nprint(\"ASCII value of\", char, \"is\", ord(char))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">11. Check if character is vowel or consonant<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>ch = 'e'\nif ch.lower() in 'aeiou':\n    print(\"Vowel\")\nelse:\n    print(\"Consonant\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">12. Use input() and print() formatting<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>name = input(\"Enter your name: \")\nmarks = float(input(\"Enter your marks: \"))\nprint(f\"Hello {name}, you scored {marks} marks.\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">13. Use math functions (sqrt, pow, log)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import math\nnum = 16\nprint(\"Square Root:\", math.sqrt(num))\nprint(\"2 to the power 3:\", math.pow(2, 3))\nprint(\"Log base 10 of 1000:\", math.log10(1000))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">14. Simple calculator using if-elif-else<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>a = 10\nb = 5\noperator = input(\"Enter operator (+, -, *, \/): \")\nif operator == '+':\n    print(\"Result:\", a + b)\nelif operator == '-':\n    print(\"Result:\", a - b)\nelif operator == '*':\n    print(\"Result:\", a * b)\nelif operator == '\/':\n    print(\"Result:\", a \/ b)\nelse:\n    print(\"Invalid operator\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">15. Check leap year<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>year = 2024\nif (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):\n    print(year, \"is a Leap Year\")\nelse:\n    print(year, \"is not a Leap Year\")\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conditional &amp; Loops<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Check prime number<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>num = 29\nis_prime = True\n\nif num &lt;= 1:\n    is_prime = False\nelse:\n    for i in range(2, int(num ** 0.5) + 1):\n        if num % i == 0:\n            is_prime = False\n            break\n\nif is_prime:\n    print(num, \"is a Prime number\")\nelse:\n    print(num, \"is not a Prime number\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Display first 10 natural numbers<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>for i in range(1, 11):\n    print(i)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Display multiplication table of a number<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>num = 5\nfor i in range(1, 11):\n    print(num, \"x\", i, \"=\", num * i)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Calculate factorial<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>num = 5\nfactorial = 1\n\nfor i in range(1, num + 1):\n    factorial *= i\n\nprint(\"Factorial of\", num, \"is\", factorial)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Generate Fibonacci series<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>n = 10\na, b = 0, 1\n\nfor i in range(n):\n    print(a, end=\" \")\n    a, b = b, a + b\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Reverse a number<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>num = 1234\nrev = 0\n\nwhile num &gt; 0:\n    digit = num % 10\n    rev = rev * 10 + digit\n    num \/\/= 10\n\nprint(\"Reversed number is\", rev)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Palindrome check<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>num = 121\ntemp = num\nrev = 0\n\nwhile num &gt; 0:\n    rev = rev * 10 + num % 10\n    num \/\/= 10\n\nif temp == rev:\n    print(\"Palindrome number\")\nelse:\n    print(\"Not a Palindrome\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Armstrong number check<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>num = 153\nsum = 0\ntemp = num\nn = len(str(num))\n\nwhile temp &gt; 0:\n    digit = temp % 10\n    sum += digit ** n\n    temp \/\/= 10\n\nif num == sum:\n    print(\"Armstrong number\")\nelse:\n    print(\"Not an Armstrong number\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. Count digits of a number<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>num = 123456\ncount = 0\n\nwhile num &gt; 0:\n    count += 1\n    num \/\/= 10\n\nprint(\"Number of digits:\", count)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. Sum of digits<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>num = 1234\nsum = 0\n\nwhile num &gt; 0:\n    sum += num % 10\n    num \/\/= 10\n\nprint(\"Sum of digits:\", sum)\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Strings<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Reverse a string<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"hello\"\nreversed_text = text&#91;::-1]\nprint(\"Reversed string:\", reversed_text)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Check palindrome string<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"madam\"\nif text == text&#91;::-1]:\n    print(\"Palindrome string\")\nelse:\n    print(\"Not a Palindrome\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Count vowels in a string<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"Hello World\"\nvowels = 'aeiouAEIOU'\ncount = 0\n\nfor char in text:\n    if char in vowels:\n        count += 1\n\nprint(\"Number of vowels:\", count)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Convert string to uppercase and lowercase<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"Python Programming\"\nprint(\"Uppercase:\", text.upper())\nprint(\"Lowercase:\", text.lower())\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Count characters, words, spaces in a string<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"Python is fun\"\nchar_count = len(text)\nword_count = len(text.split())\nspace_count = text.count(\" \")\n\nprint(\"Characters:\", char_count)\nprint(\"Words:\", word_count)\nprint(\"Spaces:\", space_count)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Find frequency of a character<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"banana\"\nchar = 'a'\nfrequency = text.count(char)\nprint(\"Frequency of\", char, \"is\", frequency)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Replace substring<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"I like Python\"\nnew_text = text.replace(\"Python\", \"Java\")\nprint(\"Updated string:\", new_text)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Find longest word in a string<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"Python Java JavaScript\"\nwords = text.split()\nlongest = max(words, key=len)\nprint(\"Longest word:\", longest)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. Check anagram<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>str1 = \"listen\"\nstr2 = \"silent\"\n\nif sorted(str1) == sorted(str2):\n    print(\"Anagram\")\nelse:\n    print(\"Not an Anagram\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. Remove punctuation from a string<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import string\ntext = \"Hello, World!\"\ncleaned = \"\"\n\nfor char in text:\n    if char not in string.punctuation:\n        cleaned += char\n\nprint(\"String without punctuation:\", cleaned)\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Lists &amp; Tuples<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Create and display a list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>fruits = &#91;\"apple\", \"banana\", \"mango\"]\nprint(\"Fruits list:\", fruits)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Add and remove elements from list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>numbers = &#91;10, 20, 30]\nnumbers.append(40)\nnumbers.remove(20)\nprint(\"Updated list:\", numbers)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Sort and reverse list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>data = &#91;5, 2, 8, 1, 9]\ndata.sort()\nprint(\"Sorted list:\", data)\ndata.reverse()\nprint(\"Reversed list:\", data)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Find max, min, sum of list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>marks = &#91;88, 76, 90, 65]\nprint(\"Maximum:\", max(marks))\nprint(\"Minimum:\", min(marks))\nprint(\"Sum:\", sum(marks))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Merge two lists<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>list1 = &#91;1, 2, 3]\nlist2 = &#91;4, 5]\nmerged = list1 + list2\nprint(\"Merged list:\", merged)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Check element in list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>colors = &#91;\"red\", \"green\", \"blue\"]\nif \"green\" in colors:\n    print(\"Green is in the list\")\nelse:\n    print(\"Green is not in the list\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Count frequency using list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>items = &#91;\"pen\", \"pencil\", \"pen\", \"eraser\", \"pen\"]\ncount = items.count(\"pen\")\nprint(\"Pen appears\", count, \"times\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Convert list to tuple and vice versa<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>cities = &#91;\"Delhi\", \"Mumbai\", \"Chennai\"]\ncities_tuple = tuple(cities)\nprint(\"Tuple:\", cities_tuple)\nnew_list = list(cities_tuple)\nprint(\"List:\", new_list)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. Create nested list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>students = &#91;&#91;\"Ankit\", 85], &#91;\"Riya\", 92], &#91;\"Aman\", 78]]\nfor student in students:\n    print(\"Name:\", student&#91;0], \"Marks:\", student&#91;1])\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. List comprehension example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>squares = &#91;x**2 for x in range(1, 6)]\nprint(\"Squares:\", squares)\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Dictionaries &amp; Sets<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Create a dictionary with student details<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>student = {\"name\": \"Riya\", \"age\": 17, \"class\": \"11th\"}\nprint(\"Student details:\", student)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Add, update, delete dictionary items<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>student = {\"name\": \"Riya\", \"age\": 17}\nstudent&#91;\"class\"] = \"11th\"\nstudent&#91;\"age\"] = 18\ndel student&#91;\"name\"]\nprint(\"Updated dictionary:\", student)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Search key in dictionary<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>student = {\"name\": \"Riya\", \"age\": 17}\nif \"age\" in student:\n    print(\"Key 'age' found\")\nelse:\n    print(\"Key 'age' not found\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Count frequency of words using dictionary<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>text = \"apple banana apple mango banana apple\"\nwords = text.split()\nfrequency = {}\n\nfor word in words:\n    frequency&#91;word] = frequency.get(word, 0) + 1\n\nprint(\"Word frequency:\", frequency)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Merge two dictionaries<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>dict1 = {\"a\": 1, \"b\": 2}\ndict2 = {\"c\": 3, \"d\": 4}\nmerged = {**dict1, **dict2}\nprint(\"Merged dictionary:\", merged)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Create and display set<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>numbers = {1, 2, 3, 4}\nprint(\"Set:\", numbers)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Set operations (union, intersection, difference)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>a = {1, 2, 3}\nb = {3, 4, 5}\nprint(\"Union:\", a | b)\nprint(\"Intersection:\", a &amp; b)\nprint(\"Difference:\", a - b)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Check element in set<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>fruits = {\"apple\", \"banana\", \"mango\"}\nif \"banana\" in fruits:\n    print(\"Banana is in the set\")\nelse:\n    print(\"Banana is not in the set\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. Convert list to set<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>colors = &#91;\"red\", \"green\", \"blue\", \"red\"]\ncolor_set = set(colors)\nprint(\"Set:\", color_set)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. Remove duplicates using set<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>nums = &#91;1, 2, 2, 3, 4, 4, 5]\nunique = list(set(nums))\nprint(\"List without duplicates:\", unique)\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Class 12 Python Programs<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">File Handling<\/h3>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1. Read and write a text file<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>with open(\"sample.txt\", \"w\") as f:\n    f.write(\"This is a sample text file.\")\n\nwith open(\"sample.txt\", \"r\") as f:\n    content = f.read()\n    print(\"File content:\", content)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Count words in a file<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>with open(\"sample.txt\", \"r\") as f:\n    words = f.read().split()\n    print(\"Total words:\", len(words))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Count lines and characters<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>with open(\"sample.txt\", \"r\") as f:\n    lines = f.readlines()\n    line_count = len(lines)\n    char_count = sum(len(line) for line in lines)\n    print(\"Lines:\", line_count)\n    print(\"Characters:\", char_count)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Append text to a file<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>with open(\"sample.txt\", \"a\") as f:\n    f.write(\"\\nThis line is appended.\")\n\nwith open(\"sample.txt\", \"r\") as f:\n    print(f.read())\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Read file line by line<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>with open(\"sample.txt\", \"r\") as f:\n    for line in f:\n        print(line.strip())\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Remove blank lines from file<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>with open(\"sample.txt\", \"r\") as f:\n    lines = f.readlines()\n\nwith open(\"sample.txt\", \"w\") as f:\n    for line in lines:\n        if line.strip():\n            f.write(line)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Copy one file to another<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>with open(\"sample.txt\", \"r\") as f1:\n    data = f1.read()\n\nwith open(\"copy.txt\", \"w\") as f2:\n    f2.write(data)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Search for a word in file<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>word_to_find = \"sample\"\nfound = False\n\nwith open(\"sample.txt\", \"r\") as f:\n    for line in f:\n        if word_to_find in line:\n            found = True\n            break\n\nif found:\n    print(\"Word found\")\nelse:\n    print(\"Word not found\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. Replace word in file<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>with open(\"sample.txt\", \"r\") as f:\n    content = f.read()\n\ncontent = content.replace(\"sample\", \"example\")\n\nwith open(\"sample.txt\", \"w\") as f:\n    f.write(content)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. Display only numeric lines from a file<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>with open(\"sample.txt\", \"r\") as f:\n    for line in f:\n        if line.strip().isdigit():\n            print(\"Numeric line:\", line.strip())\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Functions &amp; Recursion<\/h3>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1. Function with arguments<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def greet(name):\n    print(\"Hello\", name)\n\ngreet(\"Riya\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Recursive factorial function<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def factorial(n):\n    if n == 0:\n        return 1\n    else:\n        return n * factorial(n - 1)\n\nprint(\"Factorial:\", factorial(5))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Recursive Fibonacci<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def fibonacci(n):\n    if n &lt;= 1:\n        return n\n    else:\n        return fibonacci(n - 1) + fibonacci(n - 2)\n\nfor i in range(10):\n    print(fibonacci(i), end=\" \")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Function to check prime<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def is_prime(num):\n    if num &lt;= 1:\n        return False\n    for i in range(2, int(num ** 0.5) + 1):\n        if num % i == 0:\n            return False\n    return True\n\nprint(\"Prime:\", is_prime(17))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Lambda function usage<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>square = lambda x: x * x\nprint(\"Square:\", square(4))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Return multiple values<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def calculate(a, b):\n    return a + b, a - b, a * b\n\nadd, sub, mul = calculate(10, 5)\nprint(\"Add:\", add)\nprint(\"Subtract:\", sub)\nprint(\"Multiply:\", mul)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Function to reverse string<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def reverse_string(s):\n    return s&#91;::-1]\n\nprint(\"Reversed:\", reverse_string(\"hello\"))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Function to sort list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def sort_list(lst):\n    return sorted(lst)\n\nprint(\"Sorted list:\", sort_list(&#91;4, 2, 9, 1]))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. Function to calculate GCD<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def gcd(a, b):\n    while b != 0:\n        a, b = b, a % b\n    return a\n\nprint(\"GCD:\", gcd(48, 18))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. Function to find LCM<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def gcd(a, b):\n    while b != 0:\n        a, b = b, a % b\n    return a\n\ndef lcm(a, b):\n    return a * b \/\/ gcd(a, b)\n\nprint(\"LCM:\", lcm(4, 6))\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Data Structures<\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1. Stack using list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>stack = &#91;]\nstack.append(10)\nstack.append(20)\nstack.append(30)\nprint(\"Stack after push:\", stack)\nstack.pop()\nprint(\"Stack after pop:\", stack)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Queue using list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>queue = &#91;]\nqueue.append(10)\nqueue.append(20)\nqueue.append(30)\nprint(\"Queue after enqueue:\", queue)\nqueue.pop(0)\nprint(\"Queue after dequeue:\", queue)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Linear search<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def linear_search(arr, target):\n    for i in range(len(arr)):\n        if arr&#91;i] == target:\n            return i\n    return -1\n\ndata = &#91;10, 25, 30, 45]\nprint(\"Index found at:\", linear_search(data, 30))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Binary search<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def binary_search(arr, target):\n    low = 0\n    high = len(arr) - 1\n\n    while low &lt;= high:\n        mid = (low + high) \/\/ 2\n        if arr&#91;mid] == target:\n            return mid\n        elif arr&#91;mid] &lt; target:\n            low = mid + 1\n        else:\n            high = mid - 1\n\n    return -1\n\ndata = &#91;10, 20, 30, 40, 50]\nprint(\"Index found at:\", binary_search(data, 30))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Bubble sort<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>data = &#91;64, 34, 25, 12, 22]\nn = len(data)\n\nfor i in range(n):\n    for j in range(0, n - i - 1):\n        if data&#91;j] &gt; data&#91;j + 1]:\n            data&#91;j], data&#91;j + 1] = data&#91;j + 1], data&#91;j]\n\nprint(\"Sorted list:\", data)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Selection sort<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>data = &#91;64, 25, 12, 22, 11]\n\nfor i in range(len(data)):\n    min_index = i\n    for j in range(i + 1, len(data)):\n        if data&#91;j] &lt; data&#91;min_index]:\n            min_index = j\n    data&#91;i], data&#91;min_index] = data&#91;min_index], data&#91;i]\n\nprint(\"Sorted list:\", data)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Insertion sort<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>data = &#91;12, 11, 13, 5, 6]\n\nfor i in range(1, len(data)):\n    key = data&#91;i]\n    j = i - 1\n    while j &gt;= 0 and key &lt; data&#91;j]:\n        data&#91;j + 1] = data&#91;j]\n        j -= 1\n    data&#91;j + 1] = key\n\nprint(\"Sorted list:\", data)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Merge two sorted lists<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>a = &#91;1, 3, 5]\nb = &#91;2, 4, 6]\nmerged = sorted(a + b)\nprint(\"Merged list:\", merged)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. Count even and odd numbers in list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>numbers = &#91;1, 2, 3, 4, 5, 6]\neven = 0\nodd = 0\n\nfor num in numbers:\n    if num % 2 == 0:\n        even += 1\n    else:\n        odd += 1\n\nprint(\"Even:\", even)\nprint(\"Odd:\", odd)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. Store student marks using dictionary<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>marks = {\"Riya\": 85, \"Aman\": 78, \"Kiran\": 92}\nfor name in marks:\n    print(\"Name:\", name, \"Marks:\", marks&#91;name])\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">DataFrame using Pandas (Class 12 only)<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Note: Make sure <strong>pandas<\/strong> library is installed (<code>pip install pandas<\/code>)<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1. Create DataFrame from list<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import pandas as pd\n\ndata = &#91;&#91;\"Riya\", 85], &#91;\"Aman\", 78], &#91;\"Kiran\", 92]]\ndf = pd.DataFrame(data, columns=&#91;\"Name\", \"Marks\"])\nprint(df)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Create DataFrame from dictionary<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import pandas as pd\n\ndata = {\"Name\": &#91;\"Riya\", \"Aman\", \"Kiran\"], \"Marks\": &#91;85, 78, 92]}\ndf = pd.DataFrame(data)\nprint(df)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Read CSV file into DataFrame<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import pandas as pd\n\ndf = pd.read_csv(\"students.csv\")\nprint(df)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Display column names and data types<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"Column Names:\", df.columns)\nprint(\"Data Types:\")\nprint(df.dtypes)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Select specific columns and rows<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"Only Name column:\")\nprint(df&#91;\"Name\"])\n\nprint(\"First two rows:\")\nprint(df.head(2))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Add new column<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>df&#91;\"Grade\"] = &#91;\"B\", \"C\", \"A\"]\nprint(df)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Delete column<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>df.drop(\"Grade\", axis=1, inplace=True)\nprint(df)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Filter rows using condition<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>filtered = df&#91;df&#91;\"Marks\"] &gt; 80]\nprint(\"Students with Marks &gt; 80:\")\nprint(filtered)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. Sort DataFrame<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sorted_df = df.sort_values(by=\"Marks\", ascending=False)\nprint(\"Sorted by Marks:\")\nprint(sorted_df)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. Group by a column and calculate mean<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>data = {\"Class\": &#91;\"11\", \"12\", \"11\", \"12\"], \"Marks\": &#91;85, 90, 78, 88]}\ndf = pd.DataFrame(data)\ngrouped = df.groupby(\"Class\")&#91;\"Marks\"].mean()\nprint(\"Average marks by class:\")\nprint(grouped)\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Miscellaneous\/Project Based<\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1. Student Management System (using dictionary)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>students = {}\n\nstudents&#91;\"101\"] = {\"name\": \"Riya\", \"class\": \"11\", \"marks\": 85}\nstudents&#91;\"102\"] = {\"name\": \"Aman\", \"class\": \"12\", \"marks\": 78}\n\nfor roll, details in students.items():\n    print(\"Roll No:\", roll)\n    print(\"Name:\", details&#91;\"name\"])\n    print(\"Class:\", details&#91;\"class\"])\n    print(\"Marks:\", details&#91;\"marks\"])\n    print()\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Quiz App using if-else<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>score = 0\n\nans = input(\"What is the capital of India? \")\nif ans.lower() == \"delhi\":\n    score += 1\n\nans = input(\"What is 5 + 3? \")\nif ans == \"8\":\n    score += 1\n\nprint(\"Your Score:\", score)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Mini Calculator using functions<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def calculator(a, b, op):\n    if op == '+':\n        return a + b\n    elif op == '-':\n        return a - b\n    elif op == '*':\n        return a * b\n    elif op == '\/':\n        return a \/ b\n    else:\n        return \"Invalid operator\"\n\nprint(\"Result:\", calculator(10, 5, '+'))\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Grade generator from marks<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>marks = int(input(\"Enter marks: \"))\n\nif marks &gt;= 90:\n    grade = 'A'\nelif marks &gt;= 75:\n    grade = 'B'\nelif marks &gt;= 60:\n    grade = 'C'\nelif marks &gt;= 40:\n    grade = 'D'\nelse:\n    grade = 'F'\n\nprint(\"Grade:\", grade)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Bill calculator (supermarket)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>items = {\"milk\": 40, \"bread\": 30, \"eggs\": 60}\ntotal = 0\n\nfor item, price in items.items():\n    qty = int(input(\"Enter quantity of \" + item + \": \"))\n    total += qty * price\n\nprint(\"Total Bill:\", total)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Simple password checker<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>password = input(\"Enter password: \")\n\nif len(password) &gt;= 8 and any(c.isdigit() for c in password) and any(c.isupper() for c in password):\n    print(\"Strong password\")\nelse:\n    print(\"Weak password\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. ATM simulation<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>balance = 1000\npin = \"1234\"\nentered_pin = input(\"Enter PIN: \")\n\nif entered_pin == pin:\n    amount = int(input(\"Enter amount to withdraw: \"))\n    if amount &lt;= balance:\n        balance -= amount\n        print(\"Withdrawn:\", amount)\n        print(\"Remaining balance:\", balance)\n    else:\n        print(\"Insufficient balance\")\nelse:\n    print(\"Invalid PIN\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Voting eligibility system<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>age = int(input(\"Enter your age: \"))\n\nif age &gt;= 18:\n    print(\"Eligible to vote\")\nelse:\n    print(\"Not eligible to vote\")\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. Age calculator<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>birth_year = int(input(\"Enter birth year: \"))\ncurrent_year = 2025\nage = current_year - birth_year\nprint(\"Your age is:\", age)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. Report card generator<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>name = input(\"Enter name: \")\nmarks1 = int(input(\"Marks in Math: \"))\nmarks2 = int(input(\"Marks in Science: \"))\nmarks3 = int(input(\"Marks in English: \"))\n\ntotal = marks1 + marks2 + marks3\naverage = total \/ 3\n\nif average &gt;= 90:\n    grade = 'A'\nelif average &gt;= 75:\n    grade = 'B'\nelif average &gt;= 60:\n    grade = 'C'\nelif average &gt;= 40:\n    grade = 'D'\nelse:\n    grade = 'F'\n\nprint(\"Name:\", name)\nprint(\"Total:\", total)\nprint(\"Average:\", average)\nprint(\"Grade:\", grade)\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/07\/python-programs-class-11-12-cbse-practical-file.png\" alt=\"\" class=\"wp-image-1767\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Explore 100+ CBSE Class 11 &#038; 12 Python programs with output covering fundamentals, conditionals, loops, strings, lists, dictionaries, file handling, pandas, functions, data structures, and mini projects \u2014 perfect for practical file and exam preparation.<\/p>\n","protected":false},"author":1,"featured_media":1766,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"googlesitekit_rrm_CAow44u0DA:productID":"","footnotes":""},"categories":[44,39,123],"tags":[153],"class_list":["post-1765","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-tutorials","category-practical-file","category-python-worksheets","tag-python"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>100+ Python Programs for Class 11 &amp; 12 (CBSE) \u2013 Basics to Projects with Code | Itxperts<\/title>\n<meta name=\"description\" content=\"Explore 100+ CBSE Class 11 &amp; 12 Python programs with output covering fundamentals, conditionals, loops, strings, lists, dictionaries, file handling, pandas, functions, data structures, and mini projects \u2014 perfect for practical file and exam preparation.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"100+ Python Programs for Class 11 &amp; 12 (CBSE) \u2013 Basics to Projects with Code\" \/>\n<meta property=\"og:description\" content=\"Are you a Class 11 or 12 student looking for complete Python programs for your CBSE practical file? This post brings you 100+ well-structured Python programs with output \u2014 covering everything from basics to advanced concepts like file handling, data structures, functions, Pandas, and mini projects. Whether you&#039;re preparing for school exams, board practicals, or just want to practice and improve, these programs are organized topic-wise to help you learn Python step by step.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/\" \/>\n<meta property=\"og:site_name\" content=\"Itxperts\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/itxperts.co.in\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-25T12:17:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-25T12:39:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/07\/100-Python-Programs-for-Class-11-12-CBSE-\u2013-Basics-to-Projects-with-Code-1024x683.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"683\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"@mritxperts\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"@mritxperts\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/\"},\"author\":{\"name\":\"@mritxperts\",\"@id\":\"https:\/\/itxperts.co.in\/blog\/#\/schema\/person\/77ad4d47f9f82583ee23e37010a52fc6\"},\"headline\":\"100+ Python Programs for Class 11 &amp; 12 (CBSE) \u2013 Basics to Projects with Code\",\"datePublished\":\"2025-07-25T12:17:16+00:00\",\"dateModified\":\"2025-07-25T12:39:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/\"},\"wordCount\":555,\"publisher\":{\"@id\":\"https:\/\/itxperts.co.in\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/07\/100-Python-Programs-for-Class-11-12-CBSE-\u2013-Basics-to-Projects-with-Code.png\",\"keywords\":[\"Python\"],\"articleSection\":[\"Learn Python\",\"Practical File\",\"Python Worksheets\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/\",\"url\":\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/\",\"name\":\"100+ Python Programs for Class 11 & 12 (CBSE) \u2013 Basics to Projects with Code | Itxperts\",\"isPartOf\":{\"@id\":\"https:\/\/itxperts.co.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/07\/100-Python-Programs-for-Class-11-12-CBSE-\u2013-Basics-to-Projects-with-Code.png\",\"datePublished\":\"2025-07-25T12:17:16+00:00\",\"dateModified\":\"2025-07-25T12:39:55+00:00\",\"description\":\"Explore 100+ CBSE Class 11 & 12 Python programs with output covering fundamentals, conditionals, loops, strings, lists, dictionaries, file handling, pandas, functions, data structures, and mini projects \u2014 perfect for practical file and exam preparation.\",\"breadcrumb\":{\"@id\":\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#primaryimage\",\"url\":\"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/07\/100-Python-Programs-for-Class-11-12-CBSE-\u2013-Basics-to-Projects-with-Code.png\",\"contentUrl\":\"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/07\/100-Python-Programs-for-Class-11-12-CBSE-\u2013-Basics-to-Projects-with-Code.png\",\"width\":1536,\"height\":1024,\"caption\":\"python-programs-class-11-12-cbse-practical-file\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/itxperts.co.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"100+ Python Programs for Class 11 &amp; 12 (CBSE) \u2013 Basics to Projects with Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/itxperts.co.in\/blog\/#website\",\"url\":\"https:\/\/itxperts.co.in\/blog\/\",\"name\":\"Itxperts\",\"description\":\"Leading Website Design Company in Madhya Pradesh\",\"publisher\":{\"@id\":\"https:\/\/itxperts.co.in\/blog\/#organization\"},\"alternateName\":\"Itxperts | Website Development in Madhya Pradesh\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/itxperts.co.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/itxperts.co.in\/blog\/#organization\",\"name\":\"Itxperts\",\"alternateName\":\"Leading Website Design Company in Madhya Pradesh \u2013 Itxperts\",\"url\":\"https:\/\/itxperts.co.in\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/itxperts.co.in\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/05\/cropped-itxperts_logo.png\",\"contentUrl\":\"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/05\/cropped-itxperts_logo.png\",\"width\":512,\"height\":512,\"caption\":\"Itxperts\"},\"image\":{\"@id\":\"https:\/\/itxperts.co.in\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/itxperts.co.in\",\"https:\/\/www.linkedin.com\/company\/itxpertsshivpuri\/\",\"https:\/\/www.instagram.com\/itxperts.co.in\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/itxperts.co.in\/blog\/#\/schema\/person\/77ad4d47f9f82583ee23e37010a52fc6\",\"name\":\"@mritxperts\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/itxperts.co.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/702cffafd84d85872c0d42d33a9fa39140418d7c60a1311a1f8f55b005d0570b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/702cffafd84d85872c0d42d33a9fa39140418d7c60a1311a1f8f55b005d0570b?s=96&d=mm&r=g\",\"caption\":\"@mritxperts\"},\"description\":\"I am a full-stack web developer from India with over 8 years of experience in building dynamic and responsive web solutions. Specializing in both front-end and back-end development, I have a passion for creating seamless digital experiences. When I'm not coding, I enjoy sharing insights and tutorials on the latest web technologies, helping fellow developers stay ahead in the ever-evolving tech landscape.\",\"sameAs\":[\"https:\/\/itxperts.co.in\/blog\"],\"url\":\"https:\/\/itxperts.co.in\/blog\/author\/mritxpertsgmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"100+ Python Programs for Class 11 & 12 (CBSE) \u2013 Basics to Projects with Code | Itxperts","description":"Explore 100+ CBSE Class 11 & 12 Python programs with output covering fundamentals, conditionals, loops, strings, lists, dictionaries, file handling, pandas, functions, data structures, and mini projects \u2014 perfect for practical file and exam preparation.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/","og_locale":"en_US","og_type":"article","og_title":"100+ Python Programs for Class 11 & 12 (CBSE) \u2013 Basics to Projects with Code","og_description":"Are you a Class 11 or 12 student looking for complete Python programs for your CBSE practical file? This post brings you 100+ well-structured Python programs with output \u2014 covering everything from basics to advanced concepts like file handling, data structures, functions, Pandas, and mini projects. Whether you're preparing for school exams, board practicals, or just want to practice and improve, these programs are organized topic-wise to help you learn Python step by step.","og_url":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/","og_site_name":"Itxperts","article_publisher":"https:\/\/www.facebook.com\/itxperts.co.in","article_published_time":"2025-07-25T12:17:16+00:00","article_modified_time":"2025-07-25T12:39:55+00:00","og_image":[{"width":1024,"height":683,"url":"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/07\/100-Python-Programs-for-Class-11-12-CBSE-\u2013-Basics-to-Projects-with-Code-1024x683.png","type":"image\/png"}],"author":"@mritxperts","twitter_card":"summary_large_image","twitter_misc":{"Written by":"@mritxperts","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#article","isPartOf":{"@id":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/"},"author":{"name":"@mritxperts","@id":"https:\/\/itxperts.co.in\/blog\/#\/schema\/person\/77ad4d47f9f82583ee23e37010a52fc6"},"headline":"100+ Python Programs for Class 11 &amp; 12 (CBSE) \u2013 Basics to Projects with Code","datePublished":"2025-07-25T12:17:16+00:00","dateModified":"2025-07-25T12:39:55+00:00","mainEntityOfPage":{"@id":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/"},"wordCount":555,"publisher":{"@id":"https:\/\/itxperts.co.in\/blog\/#organization"},"image":{"@id":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#primaryimage"},"thumbnailUrl":"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/07\/100-Python-Programs-for-Class-11-12-CBSE-\u2013-Basics-to-Projects-with-Code.png","keywords":["Python"],"articleSection":["Learn Python","Practical File","Python Worksheets"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/","url":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/","name":"100+ Python Programs for Class 11 & 12 (CBSE) \u2013 Basics to Projects with Code | Itxperts","isPartOf":{"@id":"https:\/\/itxperts.co.in\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#primaryimage"},"image":{"@id":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#primaryimage"},"thumbnailUrl":"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/07\/100-Python-Programs-for-Class-11-12-CBSE-\u2013-Basics-to-Projects-with-Code.png","datePublished":"2025-07-25T12:17:16+00:00","dateModified":"2025-07-25T12:39:55+00:00","description":"Explore 100+ CBSE Class 11 & 12 Python programs with output covering fundamentals, conditionals, loops, strings, lists, dictionaries, file handling, pandas, functions, data structures, and mini projects \u2014 perfect for practical file and exam preparation.","breadcrumb":{"@id":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#primaryimage","url":"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/07\/100-Python-Programs-for-Class-11-12-CBSE-\u2013-Basics-to-Projects-with-Code.png","contentUrl":"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/07\/100-Python-Programs-for-Class-11-12-CBSE-\u2013-Basics-to-Projects-with-Code.png","width":1536,"height":1024,"caption":"python-programs-class-11-12-cbse-practical-file"},{"@type":"BreadcrumbList","@id":"https:\/\/itxperts.co.in\/blog\/python-programs-class-11-12-cbse-practical-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/itxperts.co.in\/blog\/"},{"@type":"ListItem","position":2,"name":"100+ Python Programs for Class 11 &amp; 12 (CBSE) \u2013 Basics to Projects with Code"}]},{"@type":"WebSite","@id":"https:\/\/itxperts.co.in\/blog\/#website","url":"https:\/\/itxperts.co.in\/blog\/","name":"Itxperts","description":"Leading Website Design Company in Madhya Pradesh","publisher":{"@id":"https:\/\/itxperts.co.in\/blog\/#organization"},"alternateName":"Itxperts | Website Development in Madhya Pradesh","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itxperts.co.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/itxperts.co.in\/blog\/#organization","name":"Itxperts","alternateName":"Leading Website Design Company in Madhya Pradesh \u2013 Itxperts","url":"https:\/\/itxperts.co.in\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itxperts.co.in\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/05\/cropped-itxperts_logo.png","contentUrl":"https:\/\/itxperts.co.in\/blog\/wp-content\/uploads\/2025\/05\/cropped-itxperts_logo.png","width":512,"height":512,"caption":"Itxperts"},"image":{"@id":"https:\/\/itxperts.co.in\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/itxperts.co.in","https:\/\/www.linkedin.com\/company\/itxpertsshivpuri\/","https:\/\/www.instagram.com\/itxperts.co.in\/"]},{"@type":"Person","@id":"https:\/\/itxperts.co.in\/blog\/#\/schema\/person\/77ad4d47f9f82583ee23e37010a52fc6","name":"@mritxperts","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itxperts.co.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/702cffafd84d85872c0d42d33a9fa39140418d7c60a1311a1f8f55b005d0570b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/702cffafd84d85872c0d42d33a9fa39140418d7c60a1311a1f8f55b005d0570b?s=96&d=mm&r=g","caption":"@mritxperts"},"description":"I am a full-stack web developer from India with over 8 years of experience in building dynamic and responsive web solutions. Specializing in both front-end and back-end development, I have a passion for creating seamless digital experiences. When I'm not coding, I enjoy sharing insights and tutorials on the latest web technologies, helping fellow developers stay ahead in the ever-evolving tech landscape.","sameAs":["https:\/\/itxperts.co.in\/blog"],"url":"https:\/\/itxperts.co.in\/blog\/author\/mritxpertsgmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/itxperts.co.in\/blog\/wp-json\/wp\/v2\/posts\/1765","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itxperts.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itxperts.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itxperts.co.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itxperts.co.in\/blog\/wp-json\/wp\/v2\/comments?post=1765"}],"version-history":[{"count":2,"href":"https:\/\/itxperts.co.in\/blog\/wp-json\/wp\/v2\/posts\/1765\/revisions"}],"predecessor-version":[{"id":1769,"href":"https:\/\/itxperts.co.in\/blog\/wp-json\/wp\/v2\/posts\/1765\/revisions\/1769"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itxperts.co.in\/blog\/wp-json\/wp\/v2\/media\/1766"}],"wp:attachment":[{"href":"https:\/\/itxperts.co.in\/blog\/wp-json\/wp\/v2\/media?parent=1765"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itxperts.co.in\/blog\/wp-json\/wp\/v2\/categories?post=1765"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itxperts.co.in\/blog\/wp-json\/wp\/v2\/tags?post=1765"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}