Files in Python represent sequences of bytes stored on disk for permanent storage. They can be opened in different modes like read, write, append etc using the open() function, which returns a file object. Common file operations include writing, reading, seeking to specific locations, and closing the file. The with statement is recommended for opening and closing files to ensure they are properly closed even if an exception occurs.
The document discusses stacks in C++. It defines a stack as a data structure that follows LIFO (Last In First Out) principle where the last element added is the first to be removed. Stacks can be implemented using arrays or linked lists. The key operations on a stack are push which adds an element and pop which removes an element. Example applications of stacks include function call stacks, converting infix to postfix notation, and reversing arrays.
The document discusses various Python flow control statements including if/else, for loops, while loops, break and continue. It provides examples of using if/else statements for decision making and checking conditions. It also demonstrates how to use for and while loops for iteration, including using the range function. It explains how break and continue can be used to terminate or skip iterations. Finally, it briefly mentions pass, for, while loops with else blocks, and nested loops.
The document discusses file handling in Python. It explains that a file is used to permanently store data in non-volatile memory. It describes opening, reading, writing, and closing files. It discusses opening files in different modes like read, write, append. It also explains attributes of file objects like name, closed, and mode. The document also covers reading and writing text and binary files, pickle module for serialization, and working with CSV files and the os.path module.
A file is collection of information/data in a particular format.
Python too supports file handling and allows users to handle files i.e., to read and write files, along with many other file handling options, to operate on files.
This document provides an introduction to the Python programming language. It discusses Python's design philosophy emphasizing readability. It also covers printing messages, reading input, variables and data types, operators, and basic syntax like comments and identifiers. Arithmetic, relational, logical and bitwise operators are explained along with examples.
This document provides an overview of file handling in Python. It discusses different file types like text files, binary files, and CSV files. It explains how to open, read, write, close, and delete files using functions like open(), read(), write(), close(), and os.remove(). It also covers reading and writing specific parts of a file using readline(), readlines(), seek(), and tell(). The document demonstrates how to handle binary files using pickle for serialization and deserialization. Finally, it shows how the os module can be used for file operations and how the csv module facilitates reading and writing CSV files.
Functional dependencies (FDs) describe relationships between attributes in a database relation. FDs constrain the values that can appear across attributes for each tuple. They are used to define database normalization forms.
Some examples of FDs are: student ID determines student name and birthdate; sport name determines sport type; student ID and sport name determine hours practiced per week.
FDs can be trivial, non-trivial, multi-valued, or transitive. Armstrong's axioms provide rules for inferring new FDs. The closure of a set of attributes includes all attributes functionally determined by that set according to the FDs. Closures are used to identify keys, prime attributes, and equivalence of FDs.
Unit 10 discusses files and file handling in C. It introduces the concept of data files, which allow data to be stored on disks and accessed whenever needed. There are two main types of data files: standard/high-level files and system/low-level files. Standard files are further divided into text and binary files.
To read from or write to files, a program must first open the file. This establishes a link between the program and operating system. Various library functions allow reading, writing, and processing file contents, such as fopen() to open a file, fread() and fwrite() for record input/output, and fseek() to move the file pointer to different positions for direct access of
This document discusses files in Python. It begins by defining what a file is and explaining that files enable persistent storage on disk. It then covers opening, reading from, and writing to files in Python. The main types of files are text and binary, and common file operations are open, close, read, and write. It provides examples of opening files in different modes, reading files line by line or in full, and writing strings or lists of strings to files. It also discusses searching files and handling errors when opening files. In the end, it presents some exercises involving copying files, counting words in a file, and converting decimal to binary.
The document discusses functions, modules, and how to modularize Python programs. It provides examples of defining functions, using parameters, returning values, and function scope. It also discusses creating modules, importing modules, and the difference between running a Python file as a module versus running it as the main script using the __name__ == "__main__" check. The key points are that functions help break programs into reusable and readable components, modules further help organize code, and the __name__ check allows code to run differently depending on how it is imported or run directly.
Integrity constraints are rules used to maintain data quality and ensure accuracy in a relational database. The main types of integrity constraints are domain constraints, which define valid value sets for attributes; NOT NULL constraints, which enforce non-null values; UNIQUE constraints, which require unique values; and CHECK constraints, which specify value ranges. Referential integrity links data between tables through foreign keys, preventing orphaned records. Integrity constraints are enforced by the database to guard against accidental data damage.
This document discusses parameters in C++. There are two types of parameters: formal parameters defined in a function and actual parameters passed during a function call. C++ supports two ways of passing parameters: call by value where the formal parameter is a copy of the actual value, and call by reference where the formal parameter is an alias to the actual parameter. Call by reference allows a function to modify the original value. While it is more efficient for large data types, it can be ambiguous whether a parameter is intended for input or output.
This document discusses exception handling in C++. It defines an exception as an event that occurs during program execution that disrupts normal flow, like divide by zero errors. Exception handling allows the program to maintain normal flow even after errors by catching and handling exceptions. It describes the key parts of exception handling as finding problems, throwing exceptions, catching exceptions, and handling exceptions. The document provides examples of using try, catch, and throw blocks to handle exceptions in C++ code.
This document discusses transaction processing and concurrency control in database systems. It defines a transaction as a unit of program execution that accesses and possibly modifies data. It describes the key properties of transactions as atomicity, consistency, isolation, and durability. It discusses how concurrency control techniques like locking and two-phase locking protocols are used to ensure serializable execution of concurrent transactions.
Loops execute a block of code a specified number of times, or while a specified condition is true.
Often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal lines in a script we can use loops to perform a task like this.
In PHP, we have the following looping statements:
while - loops through a block of code while a specified condition is true
do...while - loops through a block of code once, and then repeats the loop as long as a specified condition is true
for - loops through a block of code a specified number of times
foreach - loops through a block of code for each element in an array
The document describes what an XML Schema is and its key components and purposes. It defines an XML Schema as describing the structure of an XML document, and that it can define elements, attributes, element sequence and number, data types, and default values. It compares XML Schemas to DTDs, noting schemas are more powerful and support namespaces and data types. The document provides examples of using XML Schema to define simple and complex elements, attributes, and restrictions.
Packages in Java allow grouping of related classes and interfaces to avoid naming collisions. Some key points about packages include:
- Packages allow for code reusability and easy location of files. The Java API uses packages to organize core classes.
- Custom packages can be created by specifying the package name at the beginning of a Java file. The class files are then compiled to the corresponding directory structure.
- The import statement and fully qualified names can be used to access classes from other packages. The classpath variable specifies locations of package directories and classes.
Functions allow programmers to organize and reuse code. There are three types of functions: built-in functions, modules, and user-defined functions. User-defined functions are created using the def keyword and can take parameters and arguments. Functions can return values and have different scopes depending on if a variable is local or global. Recursion is when a function calls itself, and is useful for breaking down complex problems into simpler sub-problems. Common recursive functions calculate factorials, Fibonacci numbers, and generate the Pascal's triangle.
An array is a data structure that stores multiple values in a single variable. There are two main types of arrays in PHP: indexed arrays which use integers as keys and associative arrays which use named keys like strings. The document discusses how to define, access, iterate through and perform operations on arrays in PHP such as counting elements and checking if a key exists.
Functional dependency defines a relationship between attributes in a table where a set of attributes determine another attribute. There are different types of functional dependencies including trivial, non-trivial, multivalued, and transitive. An example given is a student table with attributes Stu_Id, Stu_Name, Stu_Age which has the functional dependency of Stu_Id->Stu_Name since the student ID uniquely identifies the student name.
This document discusses stacks and queues as linear data structures. It defines stacks as last-in, first-out (LIFO) collections where the last item added is the first removed. Queues are first-in, first-out (FIFO) collections where the first item added is the first removed. Common stack and queue operations like push, pop, insert, and remove are presented along with algorithms and examples. Applications of stacks and queues in areas like expression evaluation, string reversal, and scheduling are also covered.
This chapter introduces XHTML and covers:
- The transition from HTML to XHTML and XML syntax requirements
- The anatomy of a web page including head, body, and DTD sections
- Common inline and block-level tags for formatting text and elements
- Special characters and how to display them
- Creating hyperlinks within and between pages using absolute and relative linking
The document discusses various SQL concepts like views, triggers, functions, indexes, joins, and stored procedures. Views are virtual tables created by joining real tables, and can be updated, modified or dropped. Triggers automatically run code when data is inserted, updated or deleted from a table. Functions allow reusable code and improve clarity. Indexes allow faster data retrieval. Joins combine data from different tables. Stored procedures preserve data integrity.
The document provides information on various list methods in Python like list creation, accessing items from lists, slicing lists, and common list methods like append(), count(), extend(), index(), insert(), pop(), copy(), remove(), reverse(), and sort(). It includes the syntax and examples to demonstrate how each method works on lists. Various programs are given to showcase inserting, removing, sorting, copying and reversing elements in lists using the different list methods.
The document discusses data file handling in Python. It covers the basics of opening, reading from, and writing to both text and binary files.
The key points covered include: opening and closing files, different file access modes, reading methods like readline(), readlines(), and read(), writing methods like write() and writelines(), random access methods like seek() and tell(), pickling and unpickling using the pickle module, and the differences between text and binary files.
This document provides an overview of file handling in Python. It begins by outlining learning objectives related to understanding different file types, opening and closing files, and reading from and writing to files. It then discusses the need for data file handling to permanently store program data. Various file types are introduced, including text files, CSV files, and binary files. Methods for opening, reading from, writing to, and closing both text and binary files are described. The pickle module is explained for pickling and unpickling Python objects for storage in binary files. Finally, random access methods like tell() and seek() are briefly covered.
Unit 10 discusses files and file handling in C. It introduces the concept of data files, which allow data to be stored on disks and accessed whenever needed. There are two main types of data files: standard/high-level files and system/low-level files. Standard files are further divided into text and binary files.
To read from or write to files, a program must first open the file. This establishes a link between the program and operating system. Various library functions allow reading, writing, and processing file contents, such as fopen() to open a file, fread() and fwrite() for record input/output, and fseek() to move the file pointer to different positions for direct access of
This document discusses files in Python. It begins by defining what a file is and explaining that files enable persistent storage on disk. It then covers opening, reading from, and writing to files in Python. The main types of files are text and binary, and common file operations are open, close, read, and write. It provides examples of opening files in different modes, reading files line by line or in full, and writing strings or lists of strings to files. It also discusses searching files and handling errors when opening files. In the end, it presents some exercises involving copying files, counting words in a file, and converting decimal to binary.
The document discusses functions, modules, and how to modularize Python programs. It provides examples of defining functions, using parameters, returning values, and function scope. It also discusses creating modules, importing modules, and the difference between running a Python file as a module versus running it as the main script using the __name__ == "__main__" check. The key points are that functions help break programs into reusable and readable components, modules further help organize code, and the __name__ check allows code to run differently depending on how it is imported or run directly.
Integrity constraints are rules used to maintain data quality and ensure accuracy in a relational database. The main types of integrity constraints are domain constraints, which define valid value sets for attributes; NOT NULL constraints, which enforce non-null values; UNIQUE constraints, which require unique values; and CHECK constraints, which specify value ranges. Referential integrity links data between tables through foreign keys, preventing orphaned records. Integrity constraints are enforced by the database to guard against accidental data damage.
This document discusses parameters in C++. There are two types of parameters: formal parameters defined in a function and actual parameters passed during a function call. C++ supports two ways of passing parameters: call by value where the formal parameter is a copy of the actual value, and call by reference where the formal parameter is an alias to the actual parameter. Call by reference allows a function to modify the original value. While it is more efficient for large data types, it can be ambiguous whether a parameter is intended for input or output.
This document discusses exception handling in C++. It defines an exception as an event that occurs during program execution that disrupts normal flow, like divide by zero errors. Exception handling allows the program to maintain normal flow even after errors by catching and handling exceptions. It describes the key parts of exception handling as finding problems, throwing exceptions, catching exceptions, and handling exceptions. The document provides examples of using try, catch, and throw blocks to handle exceptions in C++ code.
This document discusses transaction processing and concurrency control in database systems. It defines a transaction as a unit of program execution that accesses and possibly modifies data. It describes the key properties of transactions as atomicity, consistency, isolation, and durability. It discusses how concurrency control techniques like locking and two-phase locking protocols are used to ensure serializable execution of concurrent transactions.
Loops execute a block of code a specified number of times, or while a specified condition is true.
Often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal lines in a script we can use loops to perform a task like this.
In PHP, we have the following looping statements:
while - loops through a block of code while a specified condition is true
do...while - loops through a block of code once, and then repeats the loop as long as a specified condition is true
for - loops through a block of code a specified number of times
foreach - loops through a block of code for each element in an array
The document describes what an XML Schema is and its key components and purposes. It defines an XML Schema as describing the structure of an XML document, and that it can define elements, attributes, element sequence and number, data types, and default values. It compares XML Schemas to DTDs, noting schemas are more powerful and support namespaces and data types. The document provides examples of using XML Schema to define simple and complex elements, attributes, and restrictions.
Packages in Java allow grouping of related classes and interfaces to avoid naming collisions. Some key points about packages include:
- Packages allow for code reusability and easy location of files. The Java API uses packages to organize core classes.
- Custom packages can be created by specifying the package name at the beginning of a Java file. The class files are then compiled to the corresponding directory structure.
- The import statement and fully qualified names can be used to access classes from other packages. The classpath variable specifies locations of package directories and classes.
Functions allow programmers to organize and reuse code. There are three types of functions: built-in functions, modules, and user-defined functions. User-defined functions are created using the def keyword and can take parameters and arguments. Functions can return values and have different scopes depending on if a variable is local or global. Recursion is when a function calls itself, and is useful for breaking down complex problems into simpler sub-problems. Common recursive functions calculate factorials, Fibonacci numbers, and generate the Pascal's triangle.
An array is a data structure that stores multiple values in a single variable. There are two main types of arrays in PHP: indexed arrays which use integers as keys and associative arrays which use named keys like strings. The document discusses how to define, access, iterate through and perform operations on arrays in PHP such as counting elements and checking if a key exists.
Functional dependency defines a relationship between attributes in a table where a set of attributes determine another attribute. There are different types of functional dependencies including trivial, non-trivial, multivalued, and transitive. An example given is a student table with attributes Stu_Id, Stu_Name, Stu_Age which has the functional dependency of Stu_Id->Stu_Name since the student ID uniquely identifies the student name.
This document discusses stacks and queues as linear data structures. It defines stacks as last-in, first-out (LIFO) collections where the last item added is the first removed. Queues are first-in, first-out (FIFO) collections where the first item added is the first removed. Common stack and queue operations like push, pop, insert, and remove are presented along with algorithms and examples. Applications of stacks and queues in areas like expression evaluation, string reversal, and scheduling are also covered.
This chapter introduces XHTML and covers:
- The transition from HTML to XHTML and XML syntax requirements
- The anatomy of a web page including head, body, and DTD sections
- Common inline and block-level tags for formatting text and elements
- Special characters and how to display them
- Creating hyperlinks within and between pages using absolute and relative linking
The document discusses various SQL concepts like views, triggers, functions, indexes, joins, and stored procedures. Views are virtual tables created by joining real tables, and can be updated, modified or dropped. Triggers automatically run code when data is inserted, updated or deleted from a table. Functions allow reusable code and improve clarity. Indexes allow faster data retrieval. Joins combine data from different tables. Stored procedures preserve data integrity.
The document provides information on various list methods in Python like list creation, accessing items from lists, slicing lists, and common list methods like append(), count(), extend(), index(), insert(), pop(), copy(), remove(), reverse(), and sort(). It includes the syntax and examples to demonstrate how each method works on lists. Various programs are given to showcase inserting, removing, sorting, copying and reversing elements in lists using the different list methods.
The document discusses data file handling in Python. It covers the basics of opening, reading from, and writing to both text and binary files.
The key points covered include: opening and closing files, different file access modes, reading methods like readline(), readlines(), and read(), writing methods like write() and writelines(), random access methods like seek() and tell(), pickling and unpickling using the pickle module, and the differences between text and binary files.
This document provides an overview of file handling in Python. It begins by outlining learning objectives related to understanding different file types, opening and closing files, and reading from and writing to files. It then discusses the need for data file handling to permanently store program data. Various file types are introduced, including text files, CSV files, and binary files. Methods for opening, reading from, writing to, and closing both text and binary files are described. The pickle module is explained for pickling and unpickling Python objects for storage in binary files. Finally, random access methods like tell() and seek() are briefly covered.
This document discusses file handling in Python. It explains that files are used to permanently store data as variables are volatile. There are three main types of files - text, binary, and CSV files. Text files store human-readable text while binary files contain arbitrary binary data. CSV files store tabular data with commas as the default delimiter. The document outlines the steps to process a file which include opening the file, performing operations, and closing the file. It specifically discusses binary files, noting they are encoded as byte streams and Python's pickle module is used to convert data to bytes for writing and back for reading. The pickle methods dump() and load() are used to write and read pickled data to and from binary files.
This document discusses file handling in Python. It begins by explaining that files allow permanent storage of data, unlike standard input/output which is volatile. It then covers opening files in different modes, reading files line-by-line or as a whole, and modifying the file pointer position using seek(). Key points include opening files returns a file object, reading can be done line-by-line with for loops or using read()/readlines(), and seek() allows changing the file pointer location.
This document discusses file handling in Python. It begins by explaining that files allow permanent storage of data, unlike standard input/output which is volatile. It then covers opening files in different modes, reading and writing file contents using methods like read(), readline(), readlines(), seeking to different positions, and closing files. Examples are provided to illustrate reading temperature data from one file and writing converted values to another file. The document also discusses creating, deleting and renaming files and folders using OS module functions.
At the end of this lecture students should be able to;
Define the C standard functions for managing file input output.
Apply taught concepts for writing programs.
The document discusses file handling and regular expressions in Python programming. It covers opening, reading, and writing files in both text and binary modes. It also describes parsing text files using built-in functions and regular expressions. Regular expressions topics covered include characters, character classes, quantifiers, grouping, capturing, assertions, and flags. The document provides examples of using the re module to search and manipulate strings using regular expression patterns.
Here are the answers to the quiz questions:
1. def read_file(file_name):
lines = []
with open(file_name, 'r') as f:
for line in f:
lines.append(line)
return lines
2. def input_list():
n = int(input("Enter number of elements : "))
list1 = []
for i in range(0, n):
ele = float(input())
list1.append(ele)
return list1
def output_list(list1):
for i in list1:
print(i)
3. def display_file(filename):
with open(filename
The document provides information about file handling in Python. It discusses the basic operations on files like opening, reading, writing and closing files. It explains text files and binary files, different file access modes, and methods to read and write data from/to files like readline(), readlines(), read(), write() and writelines(). It also covers random access methods like seek() and tell() as well as pickling and unpickling using the pickle module. Finally, it highlights the differences between text and binary files.
The document provides an overview of file handling in C++. It discusses key concepts such as streams, file types (text and binary), opening and closing files, file modes, input/output operations, and file pointers. Functions for reading and writing to text files include put(), get(), and getline(). Binary files use write() and read() functions. File pointers can be manipulated using seekg(), seekp(), tellg(), and tellp() to move through files.
This document discusses files and exception handling in Python. It begins by defining files and describing different types of files like data, text, and program files. It then covers topics like sequential and random file access, opening and closing files, reading and writing to files, and using file dialogs. The document also discusses retrieving data from the web using functions like urlopen. Finally, it defines exceptions and different types of errors like syntax, runtime, and logical errors. It explains how to handle exceptions in Python using try/except blocks and predefined or user-defined exceptions.
The document discusses files in Python. It describes that files allow storing data permanently on disk that can be accessed by Python programs. There are two main types of files - text files, which store data as characters, and binary files, which store data in the same format as memory. The document outlines various methods for opening, reading, writing, and closing files in Python. It also discusses file paths and different file access modes.
Files in Python can be used to read data from disk files into a Python program and write data from a Python program back to disk files. There are two main types of files: text files, which store data as characters, and binary files, which store data in the same format as memory. Common file operations in Python include opening, reading, writing, and closing files. The open() function is used to open a file and return a file object, and the close() method closes the file and releases it for other applications. The with statement provides a convenient way to ensure files are closed after use.
This document provides an overview of streams and file input/output (I/O) in Java. It discusses the differences between text and binary files, and how to read from and write to both types of files using classes like PrintWriter, FileOutputStream, BufferedReader, and FileReader. Key points covered include opening and closing files, reading/writing text with print/println methods, and handling I/O exceptions. The goal is to learn the basic concepts and mechanisms for saving and loading data from files.
The document discusses file handling in C++. It covers:
1) Using input/output files by opening, reading from, and writing to files. Files are interpreted as sequences of bytes and can be text or binary.
2) General file I/O steps which include declaring a file name variable, associating it with a disk file, opening the file, using it, and closing it.
3) Predefined console streams like cin, cout, cerr, and clog which are used for standard input, output, error output, and buffered error output respectively.
How to Set warnings for invoicing specific customers in odooCeline George
Odoo 16 offers a powerful platform for managing sales documents and invoicing efficiently. One of its standout features is the ability to set warnings and block messages for specific customers during the invoicing process.
The *nervous system of insects* is a complex network of nerve cells (neurons) and supporting cells that process and transmit information. Here's an overview:
Structure
1. *Brain*: The insect brain is a complex structure that processes sensory information, controls behavior, and integrates information.
2. *Ventral nerve cord*: A chain of ganglia (nerve clusters) that runs along the insect's body, controlling movement and sensory processing.
3. *Peripheral nervous system*: Nerves that connect the central nervous system to sensory organs and muscles.
Functions
1. *Sensory processing*: Insects can detect and respond to various stimuli, such as light, sound, touch, taste, and smell.
2. *Motor control*: The nervous system controls movement, including walking, flying, and feeding.
3. *Behavioral responThe *nervous system of insects* is a complex network of nerve cells (neurons) and supporting cells that process and transmit information. Here's an overview:
Structure
1. *Brain*: The insect brain is a complex structure that processes sensory information, controls behavior, and integrates information.
2. *Ventral nerve cord*: A chain of ganglia (nerve clusters) that runs along the insect's body, controlling movement and sensory processing.
3. *Peripheral nervous system*: Nerves that connect the central nervous system to sensory organs and muscles.
Functions
1. *Sensory processing*: Insects can detect and respond to various stimuli, such as light, sound, touch, taste, and smell.
2. *Motor control*: The nervous system controls movement, including walking, flying, and feeding.
3. *Behavioral responses*: Insects can exhibit complex behaviors, such as mating, foraging, and social interactions.
Characteristics
1. *Decentralized*: Insect nervous systems have some autonomy in different body parts.
2. *Specialized*: Different parts of the nervous system are specialized for specific functions.
3. *Efficient*: Insect nervous systems are highly efficient, allowing for rapid processing and response to stimuli.
The insect nervous system is a remarkable example of evolutionary adaptation, enabling insects to thrive in diverse environments.
The insect nervous system is a remarkable example of evolutionary adaptation, enabling insects to thrive
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...Celine George
Analytic accounts are used to track and manage financial transactions related to specific projects, departments, or business units. They provide detailed insights into costs and revenues at a granular level, independent of the main accounting system. This helps to better understand profitability, performance, and resource allocation, making it easier to make informed financial decisions and strategic planning.
This presentation was provided by Bill Kasdorf of Kasdorf & Associates LLC and Publishing Technology Partners, during the fifth session of the NISO training series "Accessibility Essentials." Session Five: A Standards Seminar, was held May 1, 2025.
"Basics of Heterocyclic Compounds and Their Naming Rules"rupalinirmalbpharm
This video is about heterocyclic compounds, which are chemical compounds with rings that include atoms like nitrogen, oxygen, or sulfur along with carbon. It covers:
Introduction – What heterocyclic compounds are.
Prefix for heteroatom – How to name the different non-carbon atoms in the ring.
Suffix for heterocyclic compounds – How to finish the name depending on the ring size and type.
Nomenclature rules – Simple rules for naming these compounds the right way.
Common rings – Examples of popular heterocyclic compounds used in real life.
GDGLSPGCOER - Git and GitHub Workshop.pptxazeenhodekar
This presentation covers the fundamentals of Git and version control in a practical, beginner-friendly way. Learn key commands, the Git data model, commit workflows, and how to collaborate effectively using Git — all explained with visuals, examples, and relatable humor.
APM event hosted by the Midlands Network on 30 April 2025.
Speaker: Sacha Hind, Senior Programme Manager, Network Rail
With fierce competition in today’s job market, candidates need a lot more than a good CV and interview skills to stand out from the crowd.
Based on her own experience of progressing to a senior project role and leading a team of 35 project professionals, Sacha shared not just how to land that dream role, but how to be successful in it and most importantly, how to enjoy it!
Sacha included her top tips for aspiring leaders – the things you really need to know but people rarely tell you!
We also celebrated our Midlands Regional Network Awards 2025, and presenting the award for Midlands Student of the Year 2025.
This session provided the opportunity for personal reflection on areas attendees are currently focussing on in order to be successful versus what really makes a difference.
Sacha answered some common questions about what it takes to thrive at a senior level in a fast-paced project environment: Do I need a degree? How do I balance work with family and life outside of work? How do I get leadership experience before I become a line manager?
The session was full of practical takeaways and the audience also had the opportunity to get their questions answered on the evening with a live Q&A session.
Attendees hopefully came away feeling more confident, motivated and empowered to progress their careers
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetSritoma Majumder
Introduction
All the materials around us are made up of elements. These elements can be broadly divided into two major groups:
Metals
Non-Metals
Each group has its own unique physical and chemical properties. Let's understand them one by one.
Physical Properties
1. Appearance
Metals: Shiny (lustrous). Example: gold, silver, copper.
Non-metals: Dull appearance (except iodine, which is shiny).
2. Hardness
Metals: Generally hard. Example: iron.
Non-metals: Usually soft (except diamond, a form of carbon, which is very hard).
3. State
Metals: Mostly solids at room temperature (except mercury, which is a liquid).
Non-metals: Can be solids, liquids, or gases. Example: oxygen (gas), bromine (liquid), sulphur (solid).
4. Malleability
Metals: Can be hammered into thin sheets (malleable).
Non-metals: Not malleable. They break when hammered (brittle).
5. Ductility
Metals: Can be drawn into wires (ductile).
Non-metals: Not ductile.
6. Conductivity
Metals: Good conductors of heat and electricity.
Non-metals: Poor conductors (except graphite, which is a good conductor).
7. Sonorous Nature
Metals: Produce a ringing sound when struck.
Non-metals: Do not produce sound.
Chemical Properties
1. Reaction with Oxygen
Metals react with oxygen to form metal oxides.
These metal oxides are usually basic.
Non-metals react with oxygen to form non-metallic oxides.
These oxides are usually acidic.
2. Reaction with Water
Metals:
Some react vigorously (e.g., sodium).
Some react slowly (e.g., iron).
Some do not react at all (e.g., gold, silver).
Non-metals: Generally do not react with water.
3. Reaction with Acids
Metals react with acids to produce salt and hydrogen gas.
Non-metals: Do not react with acids.
4. Reaction with Bases
Some non-metals react with bases to form salts, but this is rare.
Metals generally do not react with bases directly (except amphoteric metals like aluminum and zinc).
Displacement Reaction
More reactive metals can displace less reactive metals from their salt solutions.
Uses of Metals
Iron: Making machines, tools, and buildings.
Aluminum: Used in aircraft, utensils.
Copper: Electrical wires.
Gold and Silver: Jewelry.
Zinc: Coating iron to prevent rusting (galvanization).
Uses of Non-Metals
Oxygen: Breathing.
Nitrogen: Fertilizers.
Chlorine: Water purification.
Carbon: Fuel (coal), steel-making (coke).
Iodine: Medicines.
Alloys
An alloy is a mixture of metals or a metal with a non-metal.
Alloys have improved properties like strength, resistance to rusting.
How to manage Multiple Warehouses for multiple floors in odoo point of saleCeline George
The need for multiple warehouses and effective inventory management is crucial for companies aiming to optimize their operations, enhance customer satisfaction, and maintain a competitive edge.
The Pala kings were people-protectors. In fact, Gopal was elected to the throne only to end Matsya Nyaya. Bhagalpur Abhiledh states that Dharmapala imposed only fair taxes on the people. Rampala abolished the unjust taxes imposed by Bhima. The Pala rulers were lovers of learning. Vikramshila University was established by Dharmapala. He opened 50 other learning centers. A famous Buddhist scholar named Haribhadra was to be present in his court. Devpala appointed another Buddhist scholar named Veerdeva as the vice president of Nalanda Vihar. Among other scholars of this period, Sandhyakar Nandi, Chakrapani Dutta and Vajradatta are especially famous. Sandhyakar Nandi wrote the famous poem of this period 'Ramcharit'.
A measles outbreak originating in West Texas has been linked to confirmed cases in New Mexico, with additional cases reported in Oklahoma and Kansas. The current case count is 817 from Texas, New Mexico, Oklahoma, and Kansas. 97 individuals have required hospitalization, and 3 deaths, 2 children in Texas and one adult in New Mexico. These fatalities mark the first measles-related deaths in the United States since 2015 and the first pediatric measles death since 2003.
The YSPH Virtual Medical Operations Center Briefs (VMOC) were created as a service-learning project by faculty and graduate students at the Yale School of Public Health in response to the 2010 Haiti Earthquake. Each year, the VMOC Briefs are produced by students enrolled in Environmental Health Science Course 581 - Public Health Emergencies: Disaster Planning and Response. These briefs compile diverse information sources – including status reports, maps, news articles, and web content– into a single, easily digestible document that can be widely shared and used interactively. Key features of this report include:
- Comprehensive Overview: Provides situation updates, maps, relevant news, and web resources.
- Accessibility: Designed for easy reading, wide distribution, and interactive use.
- Collaboration: The “unlocked" format enables other responders to share, copy, and adapt seamlessly. The students learn by doing, quickly discovering how and where to find critical information and presenting it in an easily understood manner.
CURRENT CASE COUNT: 817 (As of 05/3/2025)
• Texas: 688 (+20)(62% of these cases are in Gaines County).
• New Mexico: 67 (+1 )(92.4% of the cases are from Eddy County)
• Oklahoma: 16 (+1)
• Kansas: 46 (32% of the cases are from Gray County)
HOSPITALIZATIONS: 97 (+2)
• Texas: 89 (+2) - This is 13.02% of all TX cases.
• New Mexico: 7 - This is 10.6% of all NM cases.
• Kansas: 1 - This is 2.7% of all KS cases.
DEATHS: 3
• Texas: 2 – This is 0.31% of all cases
• New Mexico: 1 – This is 1.54% of all cases
US NATIONAL CASE COUNT: 967 (Confirmed and suspected):
INTERNATIONAL SPREAD (As of 4/2/2025)
• Mexico – 865 (+58)
‒Chihuahua, Mexico: 844 (+58) cases, 3 hospitalizations, 1 fatality
• Canada: 1531 (+270) (This reflects Ontario's Outbreak, which began 11/24)
‒Ontario, Canada – 1243 (+223) cases, 84 hospitalizations.
• Europe: 6,814
*Metamorphosis* is a biological process where an animal undergoes a dramatic transformation from a juvenile or larval stage to a adult stage, often involving significant changes in form and structure. This process is commonly seen in insects, amphibians, and some other animals.
1. LEARNING OBJECTIVES
At the end of this chapter you will be able to learn :
❏ Understanding Files
❏ Types of Files
❏ Understanding Text Files
❏ Opening and closing Text files
❏ Reading and writing in Files
❏ Understanding Binary Files
❏ Pickling and Unpickling
❏ Opening and closing Binary files
❏ Reading and writing in Binary Files
❏ CSV (Comma separated values) files. 2
2. NEED FOR DATA FILE HANDLING
● Mostly, in programming languages, all the values or data are stored in some
variables which are volatile in nature.
● Because data will be stored into those variables during run-time only and will be
lost once the program execution is completed. Hence it is better to save these data
permanently using files.
3
3. INTRODUCTION
● A file in itself is a sequence of bytes stored in some storage device like hard-disk,
pen-drive etc.
● Python allow us to create and manage three types of files :
1. TEXT FILE
2. BINARY FILE
3. CSV (Comma Separated Values) FILES
4
4. TEXT FILE
● A text file is structured as a sequence of lines.
● Line is a sequence of characters (ASCII or UNICODE)
● Stores information in ASCII or Unicode characters.
● Each line of text is terminated by a special character known as End Of Line
character.
● Text files are stored in human readable form and they can also be created using
any text editor.
5
5. BINARY FILE
● A file that contains information in the same format in which information
is held in memory.
● Binary file contains arbitrary binary data.
● So when we work on binary file, we have to interpret the raw bit
pattern(s) read from the file into correct type of data in our program.
● Python provides special module(s) for encoding and decoding of data
for binary file.
6
6. CSV FILES
● CSV stands for Comma Separated Values.
● CSV is just like a text file, in a human readable format which is extensively
used to store tabular data, in a spreadsheet or database.
● The separator character of CSV files is called a delimiter.
● Default delimiter is comma (,). Other delimiters are tab (t), colon (:), pipe (|),
semicolon (;) characters.
7
8. STEPS TO PROCESS A FILE
1. Determine the type of file usage.
a. Reading purpose : If the data is to be brought in from a file to memory
b. Writing purpose : If the data is to be sent from memory to file.
2. Open the file and assign its reference to a file object or file-handle.
3. Process the file as required : Perform the desired operation from the file.
4. Close the file.
9
9. OPENING A TEXT FILE
● The key function for working with files in Python is the open() function.
● It accepts two parameters : filename, and mode.
Syntax:
<file_object_name> = open(<file_name>,<mode>)
Example: f = open(“demo.txt”,”r”)
● Can specify if the file should be handled as binary or text Mode :
○ "t" - Text - Default value. Text mode
○ "b" - Binary - Binary mode (e.g. images)
10
10. ● File Objects:
○ It serves as a link to file residing in your computer.
○ It is a reference to the file on the disk and it is through this link python
program can perform operations on the files.
● File access modes:
○ It governs the type of operations(such as read or write or append)
possible in the opened file.
11
11. ● Various Modes for opening a text file are:
Mode Description
“r” Read Default value. Opens a file for reading, error if the file does
not exist.
“w” Write Opens a file for writing, creates the file if it does not exist
“a” Append Opens a file for appending, creates the file if it does not exist
“r+” Read and
Write
File must exist otherwise error is raised.Both reading and
writing operations can take place.
“w+” Write and
Read
File is created if it does not exist.If the file exists past data is
lost (truncated).Both reading and writing operations can
take place.
“a+” Append and
Read
File is created if it does not exist.If the file exists past data is
not lost .Both reading and writing(appending) operations
can take place.
12
12. CLOSING A FILE
● close()- method will free up all the system resources used by the file, this means
that once file is closed, we will not be able to use the file object any more.
● <fileobject>. close() will be used to close the file object, once we have finished
working on it.
Syntax:
<fileObject>.close()
Example : f.close()
● It is important to close your files, as in some cases, due to buffering,changes
made to a file may not show until you close the file.
13
13. READING FROM A FILE
➔ A Program reads a text/binary file from hard disk. Here File acts like an input
to the program.
➔ Followings are the methods to read a data from the file:
◆ read() METHOD
◆ readline() METHOD
◆ readlines() METHOD
14
14. read() METHOD
● By default the read() method returns the whole text, but you can also specify
how many characters you want to return by passing the size as argument.
Syntax: <file_object>.read([n])
where n is the size
● To read entire file : <file_object>.read()
● To reads only a part of the File : <file_object>.read(size)
f = open("demo.txt", "r")
print(f.read(15))
Returns the 15 first characters of the file "demo.txt". 15
16. readline() METHOD
● readline() will return a line read, as a string from the file.
Syntax:
<file_object>.readline()
● Example
f = open("demo.txt", "r")
print(f.readline())
● This example program will return the first line in the file “demo.txt”
irrespective of number of lines in the text file. 17
18. readlines() METHOD
● readlines() method will return a list of strings, each separated by n
● readlines() can be used to read the entire content of the file.
.
Syntax:
<file_object>.readlines()
● It returns a list, which can then be used for manipulation.
Example : f = open("demofile.txt", "r")
print(f.readlines())
19
21. WRITING TO A TEXT FILE
● A Program writes into a text/binary file in hard disk.
● Followings are the methods to write a data to the file.
○ write () METHOD
○ writelines() METHOD
● To write to an existing file, you must add a parameter to the open()
Function which specifies the mode :
○ "a" - Append - will append to the end of the file
○ "w" - Write - will overwrite any existing content
22
22. write() Method
● write() method takes a string ( as parameter ) and writes it in the file.
● For storing data with end of line character, you will have to add n character to end
of the string
● Example:
Open the file "demo_append.txt" and append content to the file:
f = open("demo_write.txt", ""a)
f.write("Hello students n We are learning data file handling…..!")
f.close()
f = open("demo_write.txt", "r") #open and read the file after the appending
print(f.read()) 23
24. writelines() METHOD
● For writing a string at a time, we use write() method, it can't be used
for writing a list, tuple etc. into a file.
● Python file method writelines() writes a sequence of strings to the file.
The sequence can be any iterable object producing strings, typically a
list of strings.
● So, whenever we have to write a sequence of string, we will use
writelines(), instead of write().
25
28. Standard Input, Output, and Error
Streams
❏ Keyboard is the standard input device
❏ stdin - reads from the keyboard
❏ Monitor is the standard output device.
❏ stdout - prints to the display
❏ If any error occurs it is also displayed on the monitor and hence it is
also the standard error device.
❏ Same as stdout but normally only for errors (stderr)
The standard devices are implemented as files called streams. They can be
used by importing the sys module.
29
29. DATA FILE HANDLING IN BINARY
FILES
● Files that store objects as some byte stream are called binary files.
● That is, all the binary files are encoded in binary format , as a sequence of
bytes, which is understood by a computer or machine.
● In binary files, there is no delimiter to end the line.
● Since they are directly in the form of binary, there is no need to translate
them.
● But they are not in human readable form and hence difficult to
understand.
30
30. ● Objects have a specific structure which must be maintained while storing or
accessing them.
● Python provides a special module called pickle module for this.
● PICKLING refers to the process of converting the structure to a byte
stream before writing to a file.
● UNPICKLING is used to convert the byte stream back to the original
structure while reading the contents of the file.
31
32. PICKLE Module
● Before reading or writing to a file, we have to import the pickle
module.
import pickle
● It provides two main methods :
○ dump() method
○ load() method
33
33. Opening and closing binary files
Opening a binary file:
Similar to text file except that it should be opened in binary
mode.Adding a ‘b’ to the text file mode makes it binary - file mode.
EXAMPLE :
f = open(“demo.dat”,”rb”)
Closing a binary file
f.close()
34
34. ● Various Modes for opening a binary file are:
Mode Description
“rb” Read Default value. Opens a file for reading, error if the file does not
exist.
“wb” Write Opens a file for writing, creates the file if it does not exist
“ab” Append Opens a file for appending, creates the file if it does not exist
“r+b”or
“rb+”
Read and
Write
File must exist otherwise error is raised.Both reading and
writing operations can take place.
“w+b”or
“wb+”
Write and
Read
File is created if it does not exist.If the file exists past data is
lost (truncated).Both reading and writing operations can take
place.
“a+b” or
“ab+”
Append and
Read
File is created if it does not exist.If the file exists past data is
not lost .Both reading and writing operations can take place.
35
35. pickle.dump() Method
● pickle.dump() method is used to write the object in file which is
opened in binary access mode.
Syntax :
pickle.dump(<structure>,<FileObject>)
● Structure can be any sequence in Python such as list, dictionary etc.
● FileObject is the file handle of file in which we have to write.
36
37. pickle.load() Method
● pickle.load() method is used to read data from a file
Syntax :
<structure> = pickle.load(<FileObject>)
● Structure can be any sequence in Python such as list, dictionary etc.
● FileObject is the file handle of file in which we have to write.
38
39. Write a method to write employee
details into a binary file. Take the
input from the user.
Employee Details:
Employee Name
Employee Number
Department
Salary
40
40. Random Access in Files : tell() and seek()
❏ tell() function is used to obtain the current position of the file pointer
Syntax : f.tell()
❏ File pointer is like a cursor, which determines from where data has to be
read or written in the file.
❏ seek () function is used to change the position of the file pointer to a given
position.
Syntax : f.seek(offset,reference_point)
Where f is the file object
41
41. CSV files
● CSV stands for Comma Separated Values.It is a type of plain text file that
uses specific structuring to arrange tabular data such as a spreadsheet or
database.
● CSV like a text file , is in a human readable format and extensively used to
store tabular data, in a spreadsheet or database.
● Each line of the file is a data record.
● Each record consists of one or more fields, separated by commas.
● The separator character of CSV files is called a delimiter.
● Default delimiter is (,).
● Other delimiters are tab(t), colon (:), pipe(|), semicolon (;) characters.
42
42. Python CSV Module
● CSV module provides two types of objects :
○ reader : to read from cvs files
○ writer : to write into csv files.
● To import csv module in our program , we use the following statement:
import csv
43
43. Opening / Closing a CSV File
● Open a CSV File :
f = open(“demo_csv.csv”,”r”)
OR
f = open(“demo_csv.csv”,”w”)
● Close a CSV File:
f.close()
44
44. Role of argument newline in opening
of csv files :
● newline argument specifies how would python handle new line characters
while working with csv files on different Operating System.
● Additional optional argument as newline = “”(null string) with the file
open() will ensure that no translation of EOL character takes place.
45
45. Steps to write data to a csv file
1. Import csv module
import csv
1. Open csv file in write mode.
f = open(“csv_demo.csv”,”w”)
1. Create the writer object.
demo_writer = csv.writer(f)
1. Write data using the methods writerow() or writerows()
demo_writer.writerow(<iterable_object>)
1. Close the file
f.close() 46
46. Writing in CSV Files
● csv.writer() :
Returns a writer object which writes data into csv files.
● writerow() :
Writes one row of data onto the writer object.
Syntax : <writer_object>.writerow()
● writerows() :
Writes multiple rows into the writer object
Syntax : <writer_object>.writerow()
47
47. Writing in CSV Files
● To write data into csv files, writer() function of csv module is used.
● csv.writer():
○ Returns a writer object which writes data into writer object.
● Significance of writer object
○ The csv.writer() returns a writer object that converts the data into a
delimited string.
○ The string can be later converted into csv files using the writerow()
or writerows() method.
48
48. ● <writer_object>.writerow() :
Writes one row of data in to the writer object.
● <writer_object>.writerows()
Writes multiple rows into the writer object.
49
50. Reading from CSV Module
● To read data from csv files, reader function of csv module is used.
● csv.reader() :
Returns a reader object.
It loads data from a csv file into an iterable after parsing delimited data.
51
51. Steps to read data from a csv file
1. Import csv module
import csv
1. Open csv file in read mode.
f = open(“csv_demo.csv”,”r”)
1. Create the reader object.
demo_reader = csv.reader(f)
1. Fetch data through for loop, row by row.
1. Close the file
f.close() 52
53. QUESTIONS FOR PRACTICE
Write a method in python to read the content from a file “Poem.txt”
and display the same on the screen.
Write a method in python to read the content from a file “Poem.txt”
line by line and display the same on the screen.
Write a method in python to count the number of lines from a text file
which are starting with an alphabet T.
Write a method in Python to count the total number of words in a file
54
54. Write a method in python to read from a text file “Poem.text” to
find and display the occurrence of the word “Twinkle”
Write a method Bigline() in Python to read lines from a text file
“Poem.txt” and display those lines which are bigger than 50
characters.
Write a method to read data from a file. All the lowercase letter
should be stored in the file “lower.txt” , all upper case characters
get stored inside the file “upper.txt” and other characters stored
inside the file “others.txt”
55