CBSE 2026 results are out, Mukul scored a perfect 100/100 in Computer ScienceSee all toppers →

KwickClips Python

Python: 204 short revision clips (page 3)

One idea per clip, with the answer written out underneath. Each clip links back to the full Python lesson it came from.

Code calling order with positional, default and keyword arguments, printing 3 tea, 1 samosa, 2 vada.What happens if qty is missing?41 secTable of calls to fee(amt, gst) with SyntaxError and TypeError results.Why is fee(amt=9, 1) an error?40 secCode with def add(x, bag=[]) where the second call prints pen and book together.Why does the old item stay in a list default?42 secNested boxes: the global box holds city, the inner weather box holds temp.Why does temp give a NameError outside the function?40 secCode with wallet = 100 and spend() using global wallet, printing 70.Why did the wallet not change without global?40 secTable of Python name search order: Local, Enclosing, Global, Built-in.What does LEGB stand for?44 secCode with global marks = 5 and change() setting local marks = 2, printing 6 5.What does print(change(), marks) print?39 secCode showing import math with math.sqrt(81) and from math import sqrt with sqrt(81), both 9.0.Why did sqrt give a NameError?40 secTable of math functions: ceil(-4.2) is -4, floor(4.8) is 4, pow(2, 3) is 8.0, fabs(-7) is 7.0.What is math.ceil(-4.2)?43 secTable of random(), randint(1, 6) and randrange(1, 6) with the values each can return.Can randrange(1, 6) give 6?40 secCode using statistics as st on runs [45, 12, 78, 12, 53], printing mean 40, median 45, mode 12.What does median() do?42 secSlide showing shop.py with def gst(price), main.py in the same folder, import shop and shop.gst(200) as 36.0.Can your own file be a module?44 secTable of crashing lines: 1000 / 0, int of ten and [1, 2][5], with their exception names.What is an exception?42 secFlowchart of try, except, else and finally paths.Does else run when there is an exception?44 secCode where int of 12a raises ValueError and except ValueError prints Not a number.Why avoid a bare except?39 secCode raising ValueError when age is -5 and printing Bad age.What does raise do?41 secCode writing Riya 88 to m.txt and reading it back.Why do variables lose data?40 secTable of file modes r, w, a and r+, w+, a+ with what each does.Why did my old lines vanish?45 secCode writing Riya and Aman to a file and printing readlines() as a list.What does readlines() return?39 secCode using with open to write Done, then printing f.closed as True.What happens when the with block ends?39 secCode writing SUNDAY, seeking to 3, reading DAY and printing tell() as 6.What does tell() return?42 secA table comparing text and binary files on what they store, readability and what they can hold.Why does a .dat file look like junk in Notepad?44 secCode dumping two student records to a binary file and loading one back as a list.What is the argument order for dump?38 secA table of which mode to use for search, append and update in a binary record file.Which mode adds a record without erasing?44 secA while True loop inside try loading records, with except EOFError ending it.Why use while True to read records?41 secCSV lines Name,Marks and Riya,88 shown next to a spreadsheet table with the same values.What does CSV stand for?38 secCode opening m.csv with newline empty, making csv.writer and calling writerows with Om 88.What does writerows() take?41 secCode looping csv.reader over two lines and printing ['Om', '88'] and ['Anu', '76'].Is 88 read from a CSV a number?38 secCode opening m.csv with newline empty and writing the row Om, 88 with csv.writer.Why is there a blank row after every CSV row?42 secPlates pushed red then blue, with the first pop removing blue.What does LIFO mean?40 secFour list operations mapped to push, pop, peek and isEmpty on a stack.Which list method pushes onto a stack?45 secA table of underflow when popping an empty stack and overflow when pushing a full one.What is underflow?39 secAn undo stack popping the latest change, and characters popped to reverse a word.Why does undo remove the latest change?41 secThe pip install command for the MySQL connector followed by the import line in Python.Where do you run the pip command?43 secA table showing fetchone, fetchmany and fetchall results on a four-row table with rowcount values.What does fetchone() return when no rows are left?41 secAn INSERT query followed by con.commit() saving the change permanently.Which operations need a commit?43 secA query using a %s placeholder with a one-value tuple, beside the same query built with format.Why does one value need a comma in (m,)?40 secPython code creating a NumPy array of marks and adding 5, with output [65 77 50].Why is NumPy fast?39 secPython code converting a marks list to a NumPy array; output shows [88 75 92] without commas.How do you create a NumPy array from a list?40 secPython code printing shape and dtype of a NumPy array: (3,) float64, and the array doubled.Why does 1 print as 1. in np.array([1, 2.5, 3])?42 secPython code comparing nums * 2 for a list and a NumPy array, with both outputs shown.What does [1, 2, 3] * 2 give?36 secA Series of marks labelled with student names, with the value fetched by its label.What does one-dimensional mean here?41 secA table of four Series sources with the index each produces.What becomes the index when you use a dictionary?45 secA label slice including its end label beside a position slice that stops before it.Does marks["Riya":"Aman"] include Aman?42 secTwo Series added label by label, with NaN for unmatched labels and the fill_value fix.Why does an unmatched label give NaN?43 secPython code building a pandas DataFrame with an Eng column and printing the table with index 0 and 1.What is a DataFrame?39 secPython code making a DataFrame from a list of dictionaries; output shows 88.0 and NaN.Why does 88 become 88.0 in a DataFrame?41 secPython code adding column S, dropping column E and printing the new DataFrame.Why does drop() seem to do nothing?41 sec

Want a plan that actually fits your board dates?

Ask Kajal Ma'am directly, 20+ years teaching computer science. Free demo class first, no payment.

Talk to Kajal Ma'am on WhatsApp

Or see the Class 12 Computer Science course →

Studying outside India?

We coach CBSE, IGCSE & international students across the globe, one-to-one, in your local time zone.

Visit International →