Posts

Python Revision Tour - Revision Notes

  CBSE Class 12 Computer Science 1 Python Advanced Programming Revision Notes (Review of Python) Interactive Mode:  Interactive Mode, as the name suggests, allows us to interact with OS. Script Mode:  In script mode, we type Python program in a file and then use interpreter to execute the content of the file. Number:  Number data type stores Numerical Values. Sequence:  A sequence is an ordered collection of items, indexed by positive integers. Arithmetic operators:  +, -, *, /, %, ** and //. Relational operators:  <, <=, >, >=, != or <> and ==. Logical operators:  or, and, and not Assignment Operator:  =, +=, -=, *=, /=, %=, **= and //= Functions in Python:  A function is named sequence of statement(s) that performs a computation. Module:  A module is a file containing Python definitions (i.e. functions) and statements. Standard library of Python is extended as module(s) to a Programmer. String:  In python, c...

Working with Functions - Revision Notes

  CBSE Class 12 Computer Science (Python) Working with Functions Revision Notes Some important points are as follows: A  Function  is a subprogram that acts on data and often returns a value. Functions make program handling easier as only a small part of the program is dealt with at a time, thereby avoiding ambiguity. By default, Python names the segment with top-level statements (main program) as  __main__ . A Function is executed in an  execution frame . The values being passed through a function-call statement are called  arguments  (or  actual parameters  or  actual arguments ) The values received in the function definition/header are called  parameters  (or  formal parameters  or  formal arguments ). Python supports three types of formal arguments: parameters Positional arguments (Required arguments), Default arguments and Keyword (or named) arguments. When the function call statement must match the number a...

Using Python Libraries - Revision Notes

  CBSE Class 12 Computer Science (Python) Using Python Libraries Revision Notes Start here in points A library refers to a collection of mudules that together cater to specific type of needs or applications. A module is a separately saved unit whose functionality can be reused at will. A function is a named block of statements that can be invoked by its name. Python can have three types of functions: built-in functions, functions in modules and user-defined functions. A Python module can contain objects like docstrings, variables, constants, classes, objects, statements, functions. A Python module has the .py extension. The doctrings are useful for documentation purposes. A Python module can be imported in a program using import statement. There are two forms of import statements import <modulename> [as <aliasname>] from <module> import <object> The built-in functions of Python are always available; one needs not import any module for them. The random module...

File Handling - Revision Notes

  CBSE Class 12 Computer Science (Python) File Handling Revision Notes Some Important points for File Handling are: A file in itself is a bunch of bytes stored on some storage devices like hard-disk, thumb-drive etc. The data files can be stored in two ways: Text files Binary files A text file stores information in ASCII or Unicode characters, where each line of text is terminated, (delimited) with a sepcial character known as EOL (End of Line) character. In text files some internal translations take place when this EOL character is read or written. A binary file is just a file that contains information in the same format in which the information is held in memory, i.e., the file content that is returned to you is raw (with no translation or no specific encoding). The open() function is used to open a data file in a program through a file-object (or a file-handle). A file-mode governs the type of operations (e.g., read/ write/ append) possible in the opened file i.e., it refers to ...

Recursion - Revision Notes

  CBSE Class 12 Computer Science (Python) Recursion Revision Notes Some important points are as follows: Recursion  refers to a programming technique in which a function calls itself either directly or indirectly. "OR"  A function is said to be recursive if it calls itself. For example: def A( ):       A( ) Here  the Function A () called itself from its own function body, so it is a recursive function,  it is the example of direct recursion as the function A() called itself. another example: def A():       B() def B():       C() def C():       A() This function is the example of Indirect recursion. A popular algorithm that uses recursion successfully is binary search algorithm. There are two cases in each recursive function, the recursive case and the base case. The base case is the case whose solution is pre-known and is used without computation. The recursive case is more general case o...

Idea of Algorithmic Efficiency - Revision Notes

  CBSE Class 12 Computer Science (Python) Idea of Algorithmic Efficiency Revision Notes Some useful Rules for Algorithm Analysis. To analyze a function analyze each statement in the function. The statement that has the greatest complexity determines the order of the function. Some helpful rules are being given for your reference: Addition Rule  "You can combine sequences of statements by using the addition rule, which states that the running time of a sequence of statements is just the maximum of the running times of each individual statement.  Multiplication Rule  This is used to determine the running time for a loop. "You need to determine the running time for the loop's body and the number of times the loop iterates. Frequently you can just multiply the running time of the body by the number of iterations.” An algorithm is a sufficiently precise method or procedure for accomplishing a specific task, which can be programmed on computer. Complexity refers to the mea...

Data Visualisation using Python - Revision Notes

  CBSE Class 12 Computer Science (Python) Data Visualization using Python Revision Notes Some important Points in Data Visualization are: Data visualization basically refers to the graphical or visual representation of information and data using visual elements like charts, graphs, and maps etc. The  matplotlib  is a Python library that provides many interfaces and functionality for 2D-graphics similar to MATLAB's in various forms. Pyplot is a collection of methods within matplotlib which allow user to construct 2D plots easily and interactively. PyPlot essentially reproduces plotting functions and behavior of MATLAB. In order to use pyplot on your computers for data visualization, you need to first import it in your Python environment by issuing  import  command for  matplotlib.pyplot . NumPy is a Python library that offer many functions for creating and manipulating arrays, which come handy while plotting. You need to import 'numpy' before using...