Computer Science Basics — Intermediate
The Fundamentals section deepened what you already knew from the Overview. This section introduces genuinely new tools: three more ways to store data (tuples, dictionaries, sets), handling errors gracefully, recursion, and a first look at organizing code with classes.
Tuples — Lists That Can't Change
A tuple looks like a list but is immutable — once created, you can't add, remove, or change its elements. This isn't a limitation for its own sake; it's useful specifically when data shouldn't change.
Why use a tuple instead of a list? When the data represents a fixed structure (a coordinate pair, a date as day/month/year) that shouldn't accidentally be modified elsewhere in your program, immutability is a feature, not a restriction.
Dictionaries — Storing Data by Key, Not Position
A list finds things by position (marks[0]). A dictionary finds things by a meaningful key instead:
Compare to a list: if you had 5 separate lists (names, ages, marks...) all indexed by the same position, a dictionary per student is usually clearer and less error-prone than keeping several parallel lists in sync by hand.
Sets — Only Unique Values, No Order
Sets are the natural tool whenever "remove duplicates" or "what's common between these two groups" is the actual problem you're solving.
Handling Errors With try/except
So far, an error (dividing by zero, converting "abc" to a number) has crashed your program. try/except lets you handle that gracefully instead:
Catching specific exception types (ValueError, ZeroDivisionError) rather than a bare except: is worth building as a habit — a bare except silently catches any error, including genuine bugs you'd want to know about.
Recursion — A Function That Calls Itself
Recursion solves a problem by breaking it into a smaller version of the same problem, until it reaches a case simple enough to answer directly:
Tracing through factorial(3):
Every recursive function needs a base case. Without one (a condition where it stops calling itself), it recurses forever until Python raises a RecursionError. This is the single most common recursion bug.
Classes — A First Look at Organizing Related Data and Behavior
A class is a template for creating objects that bundle data and the functions that operate on that data together:
self refers to the specific object the method is being called on — s1.average() uses s1's own marks, and s2.average() uses s2's, even though both were created from the exact same class.
Next Steps
Move to Advanced for implementing a stack data structure, working with modules, and combining recursion with searching/sorting — the topics that come up most in CBSE Class 12 practicals and board exams.

