Class name Subject Book title Chapter number Content Created at
Class XII Computer Science Computer Science 2 example, that of .docx is in the default EOL character in Python is the newline KBs. (\n). However, other characters can be used to indicate EOL. W...
Class XII Computer Science Computer Science 2 file and so on. Python has the io module that contains different functions for handling files. 2.3.1 Opening a file To open a file in Python, we us...
Class XII Computer Science Computer Science 2 both reading and writing, <a> for appending at the end of an existing file. The default is the read mode. In addition, we can specify whether the f...
Class XII Computer Science Computer Science 2 is opened n otes in append and read modes. The file object will be at the end of the file. That means we can write data at the end of the file and ...
Class XII Computer Science Computer Science 2 an existing file in write mode, the previous data will be erased, and the file object will be positioned at the beginning of the file. On the other...
Class XII Computer Science Computer Science 2 contents from this buffer are moved to the file located on the permanent storage. 2.4.2 The writelines() method This method is used to write multip...
Class XII Computer Science Computer Science 2 terminates with a newline (\n) character. It can also be used to read a specified number (n) of bytes of data from a file but maximum up to the new...
Class XII Computer Science Computer Science 2 returned as elements of a list. However, if splitlines() is used instead of split(), then each line is returned as element of a list, as shown in t...
Class XII Computer Science Computer Science 2 This function returns an integer that specifies the current position of the file object in the file. The position so specified is the byte position...
Class XII Computer Science Computer Science 2 the file object is: 33 Now the file object is at the beginning of the file: 0 We are moving to 10th byte position from the beginning of file The positi...
Class XII Computer Science Computer Science 2 fileobject.write('\n') choice=input("Do you wish to enter more data? (y/n): ") if choice in ('n','N'): break print("The byte position of file objec...
Class XII Computer Science Computer Science 2 which increases the shelf life. In other words, it is a method to store food items for later consumption. Serialization is the process of transform...
Class XII Computer Science Computer Science 2 pickled Python object is loaded from the file having a file handle named file_object and is stored in a new file handle called store_object. The pr...
Class XII Computer Science Computer Science 2 employee records from the file") print() readrec=1 try: with open("empfile.dat","rb") as bfile: while True: edata=pickle.load(bfile) print("Record ...
Class XII Computer Science Computer Science 2 a stream of bytes. • open() method is used to open a file in Python and it returns a file object called file handle. The file handle is used to tra...
Class XII Computer Science Computer Science 3 t ha p e r C 3 Stack “We'regoingtobeabletoaskour computerstomonitorthingsforus,andwhen certainconditionshappen,aretriggered,the computerswilltakece...
Class XII Computer Science Computer Science 3 about stack, its implementation using Python as well as etc. its applications. 3.2 S tack We have seen piles of books in the library or stack of pl...
Class XII Computer Science Computer Science 3 of a string in a stack. • We use text/image editor for editing the text/image where we have options to redo/undo the editing done. When we click on...
Class XII Computer Science Computer Science 3 that implements LIFO arrangement hence elements are added and deleted from the stack at one end only. The end from which elements are added or dele...
Class XII Computer Science Computer Science 3 the stack of glasses ComputerSCienCe- laSSXii Reprint 2026-27 3.4 I mplementatIon of Stack In p ython noteS We have learnt so far that a stack is a...
Class XII Computer Science Computer Science 3 expression can be represented in any of the three notations viz. Infix, Prefix and Postfix and are listed in Table 3.1 with examples. Table 3.1 Inf...
Class XII Computer Science Computer Science 3 empty string named postExp to store the converted postfix expression. Step 2: INPUT infix expression in a variable, say inExp Step 3: For each char...
Class XII Computer Science Computer Science 3 (postExp) 48 Computer SCienCe- ClaSSXii Reprint 2026-27 Figure 3.3: Conversion of infix expression (x + y)/(z*8) to postfix notation 3.7 e valuatIo...
Class XII Computer Science Computer Science 3 done from one end only, usually referred to as TOP. • Stack follows LIFO principle using which an element inserted in the last will be the first on...
Class XII Computer Science Computer Science 3 expression: ((2+3)*(4/2))+2 Show step-by-step process for matching parentheses using stack data structure. 5. Evaluate following postfix expression...