SlideShare a Scribd company logo
I.T
Practical
file
2020-
2021
Python is an interpreted, high-level, general-
purpose programming language. Created by
Guido van Rossum and first released in 1991,
Python's design philosophy emphasizes code
readability with its notable use of significant
whitespace. Its language constructs and object-
oriented approach aim to help programmers
write clear, logical code for small and large-scale
projects.
Submitted by-
AASHISH
(X11commerce)
Submitted to –
Aruna Ma’am
I would like to express a deep sense
of thanks and gratitude to my
computer science teacher Mrs. Aruna
Ahuja for guiding me immensely
through the course of my project. Her
constructive advice and constant
motivation have been responsible for
the successful completion of my
project.
My sincere thanks to my parents for
their motivation and support. I must
thanks my classmates for their
timely help and support for
compilation of this project.
AASHISH KUMAR
XII – COMMERCE
This is to certify that Aashish
Kumar of Class XII- Commerce . Has
completed the practical file under my
supervision . The report is the result
of his efforts and endeavours. He has
taken proper care and shown at most
sincerity in completion of this project.
I certify that this project is up to
my expectation & as per guidelines
issued by CBSE.
Mrs. Aruna Ahuja
Subject Teacher
TABLE OF CONTENTS
If statement _________________________________________ #
Program 1- if the number is positive, we print an apporiate message #
Program 2 -To print message if condition matches________________#
Program 3 -To see wether the no. is less than 200 or bigger than 200
Program 4 -To find the greater no.
If.else statement ______________________________________ #
Program 5 -To find will shop will give discount __________________#
Program 6 -To find greater no. _______________________________#
Program 7 -To find the year is leap year or not
Program 8- To check wether the person is eligble to donate blood ___#
The elif statement ____________________________________ #
Program 9- To check if the no. is positive or negative or zero ______#
Program 10- To enter temp and see wether it’s ok for going out or no#
Program 11 -To check wether no. is uppercase or lower case _______#
The nested if ________________________________________ #
Program 12- To check if the no. is positive or negative ____________#
For Loop ___________________________________________ #
Program 13 -To display no. in range __________________________#
Program 14 -To factorial of no. _______________________________#
Program 15 -To find factorial ________________________________#
Program 16 -To find sum of even and odd no. ___________________#
Program 17 -To find no. is even or odd no. ______________________#
Nested for loop ______________________________________ #
Program 18 -To print no. multiple times ________________________#
Program 19 -To print a specific pattern _______________________#
While loop _________________________________________ #
Program 20- To print no. from 1 till 10 using gap of 3 ____________#
Program 21 -To print 1 infinte _______________________________#
Program 22 -To print table of 9 _______________________________#
While else ___________________________________________ #
Program 23- To accept no.from user and diplay the result ________#
Program 24 -To check if the no. is palindrome ___________________#
While nested _________________________________________ #
Program 25 To print specific pattern___________________________#
Program 26 To find the prime numbers from 2 to 100 _________#
List ________________________________________________ #
Program 27- add 5 in all odd values and 10 in all evevn values of the list#
Program 28- display unique and duplictae items of a given list______#
Program 29-To exchange half of the elements of list with second half
elements of list _____________________________________________#
Strnig ______________________________________________ #
Program 30- display square of a element if it is an integer and changes
the case if element is a string __________________________________#
Program 31- reads a string and then prints a string that capitalizes every
other letter in the string ______________________________________#
Program 32 to check whether the string is a palindrome or not _____#
Program 33- To count the no. of vowels in the string ______________#
Program 34-To remove vowels from a string _ ___________________#
Tuples and dictionary__________________________________ #
Program 35- To input 'n' names and phone numbers to store it in a
dictionary and printthe phone number of a paarticular name_______#
Program 36- To input names of 'n' countries andf thier capital and
currency, store it in a dictionary in tacbular form. also search and dispaly
for a particular country.______________________________________#
Program 37-To input names of 'n'employes and thier salary details like
basic salary, house rent anad conveyamcr allowance. cal. total salary of
each employee and display. ___________________________________#
SQL _______________________________________________ #
1 Query-Command for creating database________________________#
2 QueryCommand for using the database________________________#
3 Query-Command for creating table___________________________#
4 Query-Command for showing the structure of table_____________#
5 Query-Command to show table present in databse _______________#
6 Query-Command for inserting data into a table__________________#
7 Query-Command to view the contents of the table________________#
8 Query-Command for retrieve data_____________________________#
9 QueryCommand for using keyword DISTINCT__________________#
10 Query-Command for using WHERE clause____________________#
11 Query-Command for using ORDER BY clause_________________#
12 Query-Command for using UPDATE_________________________#
13 Query-Command for using ALTER(to modify structureof table) __#
14 Query-Command for using LIKE operator_____________________#
15 Query-Command for using aggregate functions_________________#
16 Query-Command for using GROUP BY with COUNT __________#
17 Query-Command for using Group By with Order By____________#
18 Query-Command for equi-join of tables _______________________#
19 Query-Command to retrieve data from two tables ______________#
20 Query-Command for using Group By clause in join_____________#
21 Query-Command for using where clause and group by__________#
22 Query-Command to delete a column__________________________#
23 Query-Command for using logical operators __________________#
24 Query-Command for using arithmetic operators_______________#
25 Query-Command for select data in range _____________________#
26 Query-Command for using In condition_______________________#
27 Query-Command to change data type of an existing column______#
28 Query-Command to delete table______________________________#
29 Query-- Command to join table using Cross Join (Cartesian product)#
30 Query- Command to join table using Equi join__________________#
31 Query- Command to join table using Natural join_______________#
WORKING WITH FUNCTION__________________________________#
Program -38-Passing dictionary to function with key and value, and
update value at that key in dictionary___________________________#
Program -39-Creating a login program with the help of passing tuple to
function____________________________________________________#
Program -40-Passing list to function to calculate sum and average of all
numbers and return it in the form of tuple______________________#
Program -41-Passing list to function, and just double each value____#
BINERY FILE HANDLING____________________________________#
Program 44-Program to search for name in binary file and display record
number___________________________________________________#
Program -45-Program to delete name from binary file____________#
Progam -46-Program to update name in Binary File______________#
Program -47-Finding Number of Record in Binary File___________#
Program -48-Deleting Employee Record________________________#
COMMA SEPARATED VALUE_________________________________#
Prgram -49-Program to Counting number of records_____________#
Program -50-Program to get Sum of Salary and counting employee
getting more than 7000______________________________________#
Program -51-Program to Write data to CSV file_________________#
FILE HANDLING____________________________________________#
Program -52-Progam to read text file using read()________________#
Program -53-wap to add 2 more students of a class in a previously
created file_________________________________________________#
Program -54-wap to display contents of a previously created file____#
Program -55-wap to display the size of files in bytes_______________#
Program -56-wap to get informaion of students of a class and store these
details in a file______________________________________________#
USING PYTHON LIBRARIES___________________________________#
Program 57-Program to convert numbr to octal and hexadecimal____#
Program -58-Program to suare of no. using math module__________#
INTERFACE PYTHON WITH MYSQL___________________________#
Program-61-Program to establish connection with MySQL_________#
Program-62-Program to get all data using fetchall()______________#
Program -63-Program to get only one record using fetchone()______#
Program -64-Program to get multiple records using fetchmany()____#
Program -65-Concatenating variable with query__________________#
Program -66-String template with %s formatting_________________#
Program -67-String template with {} and format()_________________#
Program -68-Program to insert data____________________________#
Program -69-Program to Update record_________________________#
Stack________________________________________________________#
Program -71-wap to demonstrate operation on a stack _____________#
Queue_______________________________________________________#
Program -71-wap to demonstrate operations on queue_____________#
IF Statement -
An if statement is a
programming conditional
statement that, if proved
true, performs a function or
displays information. Below is
a general example of an if
statement, not specific to
any particular programming
language.
Program No.-1 – If the number is positive, we print
an appropriate message
INPUT
OUTPUT
computer science file (python)
Program No.-2 – To print message if condition
matches
INPUT
OUTPUT
Program No.-3- To see whether the no. Is less than
200 or bigger than 200
INPUT
OUTPUT
Program No.-4 –To find the greater no.
INPUT
OUTPUT
if. Else statement-
The if. Else statement
evaluates test expression
and will execute body of if only
when test condition is True.
If the condition is False, body
of else is executed.
Indentation is used to
separate the blocks.
Program No.-5- to find will shop will give discount
INPUT
OUTPUT
Program No.-6 –To find greater no.
INPUT
OUTPUT
Program No.-7 –To find the year if leap year or
not
INPUT
OUTPUT
Program No.-8 –To check whether the person is
eligible to donate blood
INPUT
OUTPUT
The elif statement –
The elif statement allows
you to check multiple
expressions for TRUE and
execute a block of code as
soon as one of the conditions
evaluates to TRUE. Similar
to the else, the elif
statement is optional.
Program No.-9- To check if the no. Is positive or
negative or zero
INPUT
OUTPUT
Program No.10- To enter temp and see whether
it’s ok for going outside
INPUT
OUTPUT
Program No.11- To check whether no. Is
uppercase or lower case
INPUT
OUTPUT
The nested if –
The nested if... else
statement allows you to
check for multiple test
expressions and execute
different code for more then
two conditions. we can have
levels of nesting inside if...else
statement
Program No.12-To check if no. Is positive or
negative
INPUT
OUTPUT
For loop-
If a sequence contains an
expression list, it is evaluated
first. Then, the first item in
the sequence is assigned to
the iterating variable
iterating var. Next, the
statements block is executed.
Each item in the list is
assigned to iterating var, and
the statement(s) block is
executed until the entire
sequence is exhausted.
Program No.13-To display no. in range
INPUT
OUTPUT
Program No.14-To find factorial of no.
INPUT
OUTPUT
Program No.15-To print Fibonacci series
INPUT
OUTPUT
Program No.16-To find sum of even and odd no.
INPUT
OUTPUT
Program No.17-To find sum of even and odd no.
INPUT
OUTPUT
Program No.18-To print no. multiple times
INPUT
OUTPUT
Program No.19-To print a specific pattern
INPUT
OUTPUT
While
Loop –
A while loop statement in
Python programming
language repeatedly executes
a target statement as long
as a given condition is true.
Program No.20-To print no. from 1 Till 10 using
gap of 3
INPUT
OUTPUT
Program No.21-To print 1 infinite
INPUT
OUTPUT
Program No.22-To print table of 9
INPUT
OUTPUT
While else –
 If the else statement is
used with a for loop,
the else statement is
executed when the loop has
exhausted iterating the
list.
 If the else statement is
used with a while loop,
the else statement is
executed when the
condition becomes false.
Program No.23 –To accept no. From user and
display the result
INPUT
OUTPUT
Program No.24- To check if the no. is palindrome
INPUT
OUTPUT
While nested-
A final note on loop nesting is
that you can put any type of
loop inside of any other type
of loop. For example, a for
loop can be inside a while loop
or vice versa.
Program No.25-To print Specific Pattern
INPUT
OUTPUT
Program No.26- To find the prime no. from 2 to 100
INPUT
OUTPUT
list-
In Python programming, a list is created by
placing all the items (elements) inside a square
bracket [], separated by commas. It can have
any number of items and they may be of
different types (integer, float, string etc.). Also,
a list can even have another list as an item.
This is called nested list
Program No.27- add 5 in all odd values and 10 in all
even values of the list
INPUT
OUTPUT
Program No.28- display unique and duplicate items of
a given list
INPUT
OUTPUT
Program No.29-To exchange half of the elements of list
with second half elements of list
INPUT
OUTPUT
Program No.30- o display square of an element if it is
an integer and changes the case if element is a string
INPUT
OUTPUT
String-
A string is a sequence of characters.
A character is simply a symbol. For example, the
English language has 26 characters.
Computers do not deal with characters; they
deal with numbers (binary). Even though you
may see characters on your screen, internally it
is stored and manipulated as a combination of
0's and 1's.
This conversion of character to a number is
called encoding, and the reverse process is
decoding. ASCII and Unicode are some of the
popular encoding used.
In Python, string is a sequence of Unicode
character. Unicode was introduced to include
every character in all languages and bring
uniformity in encoding.
Program No.31- reads a string and then prints a string
that capitalizes every other letter in the string
INPUT
OUTPUT
Program No.32 to check whether the string is a
palindrome or not
INPUT
OUTPUT
Program No.33- To count the no. of vowels in the
string
INPUT
OUTPUT
Program No.34-To remove vowels from a string
INPUT
OUTPUT
Tuples and Dictionary
Tuples-
Python tuple is a collection type data structure which is
immutable by design and holds a sequence of heterogeneous
elements. It functions almost like a Python list but with the
following distinctions.
 Tuples store a fixed set of elements and don’t allow changes
whereas the list has the provision to update its content.
 The list uses square brackets for opening and closing
whereas, and a tuple has got parentheses for the enclosure.
Dictionary-
Dictionary in Python is a scrambled collection of objects. Unlike
other data types such as a list or a set which has a single value
field, the dictionary type stores a key along with its value.
 The keys pair with values using a colon (:) while the
commas work as a separator for the elements. Also, the
entire dictionary object uses curly braces to enclose itself.
Program No.35- To input 'n' names and phone
numbers to store it in a dictionary and print the phone
number of a particular name
INPUT
OUTPUT
Program No.36- To input names of 'n' countries and
their capital and currency, store it in a dictionary in
tabular form. also search and display for a particular
country.
INPUT
OUTPUT
Program No.26- To find the prime no. from 2 to 100
INPUT
OUTPUT
computer science file (python)
Program No.37-To input names of 'employees and their
salary details like basic salary, house rent and
conveyance allowance. cal. total salary of each
employee and display
INPUT
OUTPUT
SQL
Structured Query language
is a domain-specific language used in programming and designed
for managing data held in a relational database management
system (RDBMS), or for stream processing in a relational data
stream management system (RDSMS). It is particularly useful
in handling structured data, i.e. data incorporating relations
among entities and variables.
SQL offers two main advantages over older read–write APIs
such as ISAM or VSAM. Firstly, it introduced the concept of
accessing many records with one single command. Secondly, it
eliminates the need to specify how to reach a record, e.g. with or
without an index.
Originally based upon relational algebra and tuple relational
calculus, SQL consists of many types of statements, which may
be informally classed as sublanguages, commonly: a data query
language (DQL),[a] a data definition language (DDL),a data
control language (DCL), and a data manipulation language (DML).
The scope of SQL includes data query, data manipulation (insert,
update and delete), data definition (schema creation and
modification), and data access control. Although SQL is essentially
a declarative language (4GL), it includes also procedural
elements.
1 Query-Command for creating database
2 Query Command for using the database
3 Query-Command for creating table
4 Query-Command for showing the structure of table
5 Query-Command to show table present in database
6 Query-Command for inserting data into a table
7 Query-Command to view the contents of the table
8 Query-Command for retrieve data
9 Query Command for using keyword DISTINCT
10 Query-Command for using WHERE clause
11 Query-Command for using ORDER BY clause
12 Query-Command for using UPDATE
13 Query-Command for using ALTER (to modify structure of table)
14 Query-Command for using LIKE operator
15 Query-Command for using aggregate functions
16 Query-Command for using GROUP BY with COUNT
17 Query-Command for using Group by with Order By
18 Query-Command for equi-join of tables
19 Query-Command to retrieve data from two tables
20 Query-Command for using Group By clause in join
21 Query-Command for using where clause and group by
22 Query-Command to delete a column
23 Query-Command for using logical operators
24 Query-Command for using arithmetic operators
25 Query-Command for select data in range
26 Query-Command for using in condition
27 Query-Command to change data type of an existing column
28 Query-Command to delete table
29 Query- Command to join table using Cross Join
(Cartesian product)
30 Query- Command to join table using Equi join
31 Query- Command to join table using Natural join
WORKING
WITH
FUNCTION-
Large programs are often difficult to manage,
thus large programs are divided into smaller
units known as functions.
It is simply a group of statements under any
name i.e. function name and can be invoked (call)
from other part of program.
Take an example of School Management
Software, now this software will contain
various tasks like Registering student, Fee
collection, Library book issue, TC generation,
Result Declaration etc. In this case we have to
create different functions for each task to
manage the software development.
Program NO.-38-
Passing dictionary to function with key and
value, and update value at that key in
dictionary
INPUT
OUTPUT
Program No.-39-
Creating a login program with the help of
passing tuple to function
INPUT
OUTPUT
Program No.-40-
Passing list to function to calculate sum
and average of all numbers and return it in
the form of tuple
INPUT
OUTPUT
Program No.-41-
Passing list to function, and just double
each value
INPUT
OUTPUT
Program No.-42
Program to Jumble the given string by
passing it to function using temporary
string
INPUT
OUTPUT
Program No.-43
Passing string to function and count how
many vowels in it
INPUT
OUTPUT
BINERY FILE
HANDLING
It stores the information in the same
format as in the memory i.e. data is stored
according to its data type so no translation
occurs.
In binary file there is no delimiter for a new
line
Binary files are faster and easier for a
program to read and write than text files.
Data in binary files cannot be directly read,
it can be read only through python program
for the same.
Program No.-44
Program to search for name in binary file
and display record number
INPUT
OUTPUT
Program No.-45
Program to delete name from binary file
INPUT
OUTPUT
Progam No.-46
Program to update name in Binary File
INPUT
OUTPUT
Program N0.-47
Finding Number of Record in Binary File
INPUT
OUTPUT
Program No.-48
Deleting Employee Record
INPUT
OUTPUT
COMMA SEPARATEDVALUE
CSV is a simple file format used to store
tabular data, such as a spreadsheet or
database.
Files in the CSV format can be imported to
and exported from programs that store
data in tables, such as Microsoft Excel or
OpenOffice Calc.
CSV stands for "comma-separated values“.
A comma-separated values file is a delimited
text file that uses a comma to separate
values.
record consists of one or more fields,
separated by commas. The use of the
comma as a field separator is the source of
the name for this file format
Prgram No.-49
Program to Counting number of records
INPUT
OUTPUT
Program No.-50
Program to get Sum of Salary and counting
employee getting more than 7000
INPUT
OUTPUT
Program No.-51
Program to Write data to CSV file
INPUT
OUTPUT
FILE
HANDLING
Text file stores information in ASCII OR UNICODE
character. In text file everything will be stored as a
character for example if data is “computer” then it
will take 8 bytes and if the data is floating value
like 11237.9876 it will take 10 bytes.
In text file each like is terminated by special
character called EOL. In text file some translation
takes place when this EOL character is read or
written. In python EOL is ‘n’ or ‘r’ or combination
of both
Program No-52
Progam to read text file using read()
INPUT
OUTPUT
Program No.-53
wap to add 2 more students of a class in a
previously created file
INPUT
OUTPUT
Program No.-54
wap to display contents of a previously
created file
INPUT
OUTPUT
Program No.-55
wap to display the size of files in bytes
INPUT
OUTPUT
Program No.-56
wap to get informaion of students of a
class and store these details in a file
INPUT
OUTPUT
USING PYTHON
LIBRARIES
As our program become larger and more complex
the need to organize our code becomes greater. We
have already learnt in Function chapter that large
and complex program should be divided into
functions that perform a specific task. As we
write more and more functions in a program, we
should consider organizing of functions by storing
them in modules
A module is simply a file that contains Python code.
When we break a program into modules, each
modules should contain functions that perform
related tasks.
Commonly used modules that contains source code
for generic needs are called Libraries.
computer science file (python)
Program No.57
Program to convert numbr to octal and
hexadecimal
INPUT
OUTPUT
Program No.-58
Program to suare of no. using math module
INPUT
OUTPUT
INTERFACE PYTHON
WITH MYSQL
Before we connect python program with any database
like MySQL we need to build a bridge to connect
Python and MySQL.
To build this bridge so that data can travel both ways
we need a connector called “mysql.connector”.
We can install “mysql.connector” by using following
methods:
At command prompt (Administrator login)
Type “pip install mysql.connector” and press enter
n
“https://dev.mysql.com/downloads/connector/python/”
and download connector as per OS and Python version
Program No.-61
Program to establish connection with MySQL
INPUT
OUTPUT
Program No.-62
Program to get all data using fetchall()
INPUT
OUTPUT
Program No.-63
Program to get only one record using
fetchone()
INPUT
OUTPUT
Program No.-64
Program to get multiple records using
fetchmany()
INPUT
OUTPUT
Program No.-65
Concatenating variable with query
INPUT
OUTPUT
Program No.-66
String template with %s formatting
INPUT
OUTPUT
Program No.-67
String template with {} and format()
INPUT
OUTPUT
Program No.-68
Program to insert data
INPUT
OUTPUT
Program No.-69
Program to Update record
INPUT
OUTPUT
STACK
 A stack is a collection of data
items that can be accessed at only
one end, called top.
 Items can be inserted and deleted
in a stack only at the top.
 The last item inserted in a stack
is the first one to be deleted.
 Therefore, a stack is called a
Last-In-first-Out (LIFO) data
structure.
 2 mains operations on Stack is
PUSH &POP
 PUSH means inserting new item
at top and POP means deleting item
from top.
Program No.-71
Write a menu based program to demonstrate
operation on a stack
INPUT
computer science file (python)
OUTPUT
QUEUE
 Queue is a linear list which follows
FIFO approach.
 Queue allows addition of element only
at one end called REAR (end of list) &
Deletion of element only from FRONT end
(beginning of list).
 The operation of addition and deletion
is known as Enqueue and Dequeue
respectively.
 Applications of Queue:
oPrinter Spooling
oCPU Scheduling
oMail Service
oKeyboard Buffering
oElevator
Program No.-71
Write a menu based program to demonstrate
operations on queue
INPUT
computer science file (python)
OUTPUT
computer science file (python)

More Related Content

DOCX
Computer Science Practical File class XII
DOCX
CBSE Class 12 Computer practical Python Programs and MYSQL
DOCX
computer science with python project for class 12 cbse
PDF
Computer science project.pdf
PDF
Physics project class 11.pdf
PDF
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
DOCX
Anemia (Investigatory project) class 11
DOCX
Dna Replication
Computer Science Practical File class XII
CBSE Class 12 Computer practical Python Programs and MYSQL
computer science with python project for class 12 cbse
Computer science project.pdf
Physics project class 11.pdf
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Anemia (Investigatory project) class 11
Dna Replication

What's hot (20)

PDF
Human-Body-Systems-Workbook.208290491.pdf
DOCX
Phyical Education Project Class 12 CBSE on Volleyball
PDF
Chemistry project part 1 caseins in milk......
PDF
Class 11 Chemistry Practical File 2021-22 with Observationsa
PPTX
CHOCOLATE ANALYSIS
DOCX
Acknowledgement
PDF
Computer project final for class 12 Students
DOCX
Hindi project FILE CBSE class 12
DOCX
Chemistry project on casein in mik
PDF
To study Earth’s magnetic field using a compass, natal bar magnet wire plotti...
PPTX
11 Unit 1 Chapter 03 Data Handling
PPT
Maths Project 11 class(SETS)
PDF
Python revision tour i
DOCX
Transformers
PDF
PPT
Macro Economics Project - Education System!!
ODT
PREPARATION OF SOYBEAN MILK AND ITS COMPARISION WITH NATURAL MILK
PDF
ASL/ALS CLASS 12 ENGLISH PROJECT
PPTX
Physics investigatory project on different emf of cell
PDF
Complete practical file of class xii cs 2021-22
Human-Body-Systems-Workbook.208290491.pdf
Phyical Education Project Class 12 CBSE on Volleyball
Chemistry project part 1 caseins in milk......
Class 11 Chemistry Practical File 2021-22 with Observationsa
CHOCOLATE ANALYSIS
Acknowledgement
Computer project final for class 12 Students
Hindi project FILE CBSE class 12
Chemistry project on casein in mik
To study Earth’s magnetic field using a compass, natal bar magnet wire plotti...
11 Unit 1 Chapter 03 Data Handling
Maths Project 11 class(SETS)
Python revision tour i
Transformers
Macro Economics Project - Education System!!
PREPARATION OF SOYBEAN MILK AND ITS COMPARISION WITH NATURAL MILK
ASL/ALS CLASS 12 ENGLISH PROJECT
Physics investigatory project on different emf of cell
Complete practical file of class xii cs 2021-22
Ad

Similar to computer science file (python) (20)

PDF
Fico interview questions set 7
PPT
Csc 130 class 2 problem analysis and flow charts(2)
DOCX
User Manual - FIMS
PDF
Python workbook olivieri
DOC
Re pr-co
DOCX
Activity sheets mathematical expressions
PDF
Epp 6 btb 83pgs_19copies_a4_size
PPTX
Science Fair Student Slides 20xx-20xx
DOCX
COM 3135 Proposal AssignmentMANAGERIAL PROPOSAL INSTRUCTI.docx
PDF
Linux fundamentals commands
DOCX
Employment portfolio project
DOC
Programming in c notes
DOCX
CV of Vikas Kumar
PDF
Oracle 11i Configuration Document
PDF
HareshS12113506DBMSppt.pptx.pdf
DOCX
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
DOCX
PalashChatterjee_Testing
PDF
Company segmentation - an approach with R
Fico interview questions set 7
Csc 130 class 2 problem analysis and flow charts(2)
User Manual - FIMS
Python workbook olivieri
Re pr-co
Activity sheets mathematical expressions
Epp 6 btb 83pgs_19copies_a4_size
Science Fair Student Slides 20xx-20xx
COM 3135 Proposal AssignmentMANAGERIAL PROPOSAL INSTRUCTI.docx
Linux fundamentals commands
Employment portfolio project
Programming in c notes
CV of Vikas Kumar
Oracle 11i Configuration Document
HareshS12113506DBMSppt.pptx.pdf
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
PalashChatterjee_Testing
Company segmentation - an approach with R
Ad

Recently uploaded (20)

PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PDF
LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PPTX
QR Codes Qr codecodecodecodecocodedecodecode
PDF
LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1
PDF
The Internet -By the Numbers, Sri Lanka Edition
PPTX
durere- in cancer tu ttresjjnklj gfrrjnrs mhugyfrd
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PPTX
Digital Literacy And Online Safety on internet
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
“Google Algorithm Updates in 2025 Guide”
PPTX
presentation_pfe-universite-molay-seltan.pptx
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
Module 1 - Cyber Law and Ethics 101.pptx
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1
Cloud-Scale Log Monitoring _ Datadog.pdf
QR Codes Qr codecodecodecodecocodedecodecode
LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1
The Internet -By the Numbers, Sri Lanka Edition
durere- in cancer tu ttresjjnklj gfrrjnrs mhugyfrd
Introuction about WHO-FIC in ICD-10.pptx
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Digital Literacy And Online Safety on internet
An introduction to the IFRS (ISSB) Stndards.pdf
Unit-1 introduction to cyber security discuss about how to secure a system
“Google Algorithm Updates in 2025 Guide”
presentation_pfe-universite-molay-seltan.pptx
Introuction about ICD -10 and ICD-11 PPT.pptx
Decoding a Decade: 10 Years of Applied CTI Discipline
522797556-Unit-2-Temperature-measurement-1-1.pptx

computer science file (python)

  • 1. I.T Practical file 2020- 2021 Python is an interpreted, high-level, general- purpose programming language. Created by Guido van Rossum and first released in 1991, Python's design philosophy emphasizes code readability with its notable use of significant whitespace. Its language constructs and object- oriented approach aim to help programmers write clear, logical code for small and large-scale projects. Submitted by- AASHISH (X11commerce) Submitted to – Aruna Ma’am
  • 2. I would like to express a deep sense of thanks and gratitude to my computer science teacher Mrs. Aruna Ahuja for guiding me immensely through the course of my project. Her constructive advice and constant motivation have been responsible for the successful completion of my project. My sincere thanks to my parents for their motivation and support. I must thanks my classmates for their timely help and support for compilation of this project.
  • 4. This is to certify that Aashish Kumar of Class XII- Commerce . Has completed the practical file under my supervision . The report is the result of his efforts and endeavours. He has taken proper care and shown at most sincerity in completion of this project. I certify that this project is up to my expectation & as per guidelines issued by CBSE.
  • 6. TABLE OF CONTENTS If statement _________________________________________ # Program 1- if the number is positive, we print an apporiate message # Program 2 -To print message if condition matches________________# Program 3 -To see wether the no. is less than 200 or bigger than 200 Program 4 -To find the greater no. If.else statement ______________________________________ # Program 5 -To find will shop will give discount __________________# Program 6 -To find greater no. _______________________________# Program 7 -To find the year is leap year or not Program 8- To check wether the person is eligble to donate blood ___# The elif statement ____________________________________ # Program 9- To check if the no. is positive or negative or zero ______# Program 10- To enter temp and see wether it’s ok for going out or no# Program 11 -To check wether no. is uppercase or lower case _______# The nested if ________________________________________ # Program 12- To check if the no. is positive or negative ____________# For Loop ___________________________________________ # Program 13 -To display no. in range __________________________# Program 14 -To factorial of no. _______________________________# Program 15 -To find factorial ________________________________# Program 16 -To find sum of even and odd no. ___________________# Program 17 -To find no. is even or odd no. ______________________# Nested for loop ______________________________________ # Program 18 -To print no. multiple times ________________________# Program 19 -To print a specific pattern _______________________# While loop _________________________________________ # Program 20- To print no. from 1 till 10 using gap of 3 ____________# Program 21 -To print 1 infinte _______________________________# Program 22 -To print table of 9 _______________________________#
  • 7. While else ___________________________________________ # Program 23- To accept no.from user and diplay the result ________# Program 24 -To check if the no. is palindrome ___________________# While nested _________________________________________ # Program 25 To print specific pattern___________________________# Program 26 To find the prime numbers from 2 to 100 _________# List ________________________________________________ # Program 27- add 5 in all odd values and 10 in all evevn values of the list# Program 28- display unique and duplictae items of a given list______# Program 29-To exchange half of the elements of list with second half elements of list _____________________________________________# Strnig ______________________________________________ # Program 30- display square of a element if it is an integer and changes the case if element is a string __________________________________# Program 31- reads a string and then prints a string that capitalizes every other letter in the string ______________________________________# Program 32 to check whether the string is a palindrome or not _____# Program 33- To count the no. of vowels in the string ______________# Program 34-To remove vowels from a string _ ___________________# Tuples and dictionary__________________________________ # Program 35- To input 'n' names and phone numbers to store it in a dictionary and printthe phone number of a paarticular name_______# Program 36- To input names of 'n' countries andf thier capital and currency, store it in a dictionary in tacbular form. also search and dispaly for a particular country.______________________________________# Program 37-To input names of 'n'employes and thier salary details like basic salary, house rent anad conveyamcr allowance. cal. total salary of each employee and display. ___________________________________# SQL _______________________________________________ # 1 Query-Command for creating database________________________# 2 QueryCommand for using the database________________________# 3 Query-Command for creating table___________________________# 4 Query-Command for showing the structure of table_____________#
  • 8. 5 Query-Command to show table present in databse _______________# 6 Query-Command for inserting data into a table__________________# 7 Query-Command to view the contents of the table________________# 8 Query-Command for retrieve data_____________________________# 9 QueryCommand for using keyword DISTINCT__________________# 10 Query-Command for using WHERE clause____________________# 11 Query-Command for using ORDER BY clause_________________# 12 Query-Command for using UPDATE_________________________# 13 Query-Command for using ALTER(to modify structureof table) __# 14 Query-Command for using LIKE operator_____________________# 15 Query-Command for using aggregate functions_________________# 16 Query-Command for using GROUP BY with COUNT __________# 17 Query-Command for using Group By with Order By____________# 18 Query-Command for equi-join of tables _______________________# 19 Query-Command to retrieve data from two tables ______________# 20 Query-Command for using Group By clause in join_____________# 21 Query-Command for using where clause and group by__________# 22 Query-Command to delete a column__________________________# 23 Query-Command for using logical operators __________________# 24 Query-Command for using arithmetic operators_______________# 25 Query-Command for select data in range _____________________# 26 Query-Command for using In condition_______________________# 27 Query-Command to change data type of an existing column______# 28 Query-Command to delete table______________________________# 29 Query-- Command to join table using Cross Join (Cartesian product)# 30 Query- Command to join table using Equi join__________________# 31 Query- Command to join table using Natural join_______________# WORKING WITH FUNCTION__________________________________# Program -38-Passing dictionary to function with key and value, and update value at that key in dictionary___________________________# Program -39-Creating a login program with the help of passing tuple to function____________________________________________________#
  • 9. Program -40-Passing list to function to calculate sum and average of all numbers and return it in the form of tuple______________________# Program -41-Passing list to function, and just double each value____# BINERY FILE HANDLING____________________________________# Program 44-Program to search for name in binary file and display record number___________________________________________________# Program -45-Program to delete name from binary file____________# Progam -46-Program to update name in Binary File______________# Program -47-Finding Number of Record in Binary File___________# Program -48-Deleting Employee Record________________________# COMMA SEPARATED VALUE_________________________________# Prgram -49-Program to Counting number of records_____________# Program -50-Program to get Sum of Salary and counting employee getting more than 7000______________________________________# Program -51-Program to Write data to CSV file_________________# FILE HANDLING____________________________________________# Program -52-Progam to read text file using read()________________# Program -53-wap to add 2 more students of a class in a previously created file_________________________________________________# Program -54-wap to display contents of a previously created file____# Program -55-wap to display the size of files in bytes_______________# Program -56-wap to get informaion of students of a class and store these details in a file______________________________________________# USING PYTHON LIBRARIES___________________________________# Program 57-Program to convert numbr to octal and hexadecimal____# Program -58-Program to suare of no. using math module__________# INTERFACE PYTHON WITH MYSQL___________________________# Program-61-Program to establish connection with MySQL_________# Program-62-Program to get all data using fetchall()______________# Program -63-Program to get only one record using fetchone()______# Program -64-Program to get multiple records using fetchmany()____# Program -65-Concatenating variable with query__________________# Program -66-String template with %s formatting_________________#
  • 10. Program -67-String template with {} and format()_________________# Program -68-Program to insert data____________________________# Program -69-Program to Update record_________________________# Stack________________________________________________________# Program -71-wap to demonstrate operation on a stack _____________# Queue_______________________________________________________# Program -71-wap to demonstrate operations on queue_____________#
  • 11. IF Statement - An if statement is a programming conditional statement that, if proved true, performs a function or displays information. Below is a general example of an if statement, not specific to any particular programming language.
  • 12. Program No.-1 – If the number is positive, we print an appropriate message INPUT OUTPUT
  • 14. Program No.-2 – To print message if condition matches INPUT OUTPUT
  • 15. Program No.-3- To see whether the no. Is less than 200 or bigger than 200 INPUT
  • 16. OUTPUT Program No.-4 –To find the greater no. INPUT
  • 17. OUTPUT if. Else statement- The if. Else statement evaluates test expression
  • 18. and will execute body of if only when test condition is True. If the condition is False, body of else is executed. Indentation is used to separate the blocks. Program No.-5- to find will shop will give discount INPUT
  • 19. OUTPUT Program No.-6 –To find greater no.
  • 20. INPUT OUTPUT Program No.-7 –To find the year if leap year or not
  • 22. Program No.-8 –To check whether the person is eligible to donate blood INPUT OUTPUT
  • 23. The elif statement – The elif statement allows you to check multiple expressions for TRUE and execute a block of code as soon as one of the conditions evaluates to TRUE. Similar to the else, the elif statement is optional.
  • 24. Program No.-9- To check if the no. Is positive or negative or zero INPUT OUTPUT
  • 25. Program No.10- To enter temp and see whether it’s ok for going outside INPUT OUTPUT
  • 26. Program No.11- To check whether no. Is uppercase or lower case INPUT
  • 27. OUTPUT The nested if – The nested if... else statement allows you to check for multiple test expressions and execute
  • 28. different code for more then two conditions. we can have levels of nesting inside if...else statement Program No.12-To check if no. Is positive or negative INPUT
  • 29. OUTPUT For loop- If a sequence contains an expression list, it is evaluated first. Then, the first item in the sequence is assigned to
  • 30. the iterating variable iterating var. Next, the statements block is executed. Each item in the list is assigned to iterating var, and the statement(s) block is executed until the entire sequence is exhausted. Program No.13-To display no. in range
  • 33. Program No.15-To print Fibonacci series INPUT OUTPUT
  • 34. Program No.16-To find sum of even and odd no. INPUT OUTPUT
  • 35. Program No.17-To find sum of even and odd no. INPUT
  • 36. OUTPUT Program No.18-To print no. multiple times INPUT
  • 38. Program No.19-To print a specific pattern INPUT OUTPUT
  • 39. While Loop – A while loop statement in Python programming language repeatedly executes a target statement as long as a given condition is true.
  • 40. Program No.20-To print no. from 1 Till 10 using gap of 3 INPUT OUTPUT
  • 41. Program No.21-To print 1 infinite INPUT
  • 42. OUTPUT Program No.22-To print table of 9 INPUT
  • 44. While else –  If the else statement is used with a for loop, the else statement is executed when the loop has exhausted iterating the list.  If the else statement is used with a while loop, the else statement is executed when the condition becomes false.
  • 45. Program No.23 –To accept no. From user and display the result INPUT OUTPUT
  • 46. Program No.24- To check if the no. is palindrome INPUT
  • 47. OUTPUT While nested- A final note on loop nesting is that you can put any type of loop inside of any other type
  • 48. of loop. For example, a for loop can be inside a while loop or vice versa. Program No.25-To print Specific Pattern INPUT
  • 49. OUTPUT Program No.26- To find the prime no. from 2 to 100 INPUT OUTPUT
  • 50. list-
  • 51. In Python programming, a list is created by placing all the items (elements) inside a square bracket [], separated by commas. It can have any number of items and they may be of different types (integer, float, string etc.). Also, a list can even have another list as an item. This is called nested list
  • 52. Program No.27- add 5 in all odd values and 10 in all even values of the list INPUT OUTPUT
  • 53. Program No.28- display unique and duplicate items of a given list INPUT OUTPUT
  • 54. Program No.29-To exchange half of the elements of list with second half elements of list INPUT OUTPUT
  • 55. Program No.30- o display square of an element if it is an integer and changes the case if element is a string INPUT
  • 56. OUTPUT String- A string is a sequence of characters. A character is simply a symbol. For example, the English language has 26 characters. Computers do not deal with characters; they deal with numbers (binary). Even though you may see characters on your screen, internally it is stored and manipulated as a combination of 0's and 1's.
  • 57. This conversion of character to a number is called encoding, and the reverse process is decoding. ASCII and Unicode are some of the popular encoding used. In Python, string is a sequence of Unicode character. Unicode was introduced to include every character in all languages and bring uniformity in encoding. Program No.31- reads a string and then prints a string that capitalizes every other letter in the string INPUT
  • 58. OUTPUT Program No.32 to check whether the string is a palindrome or not INPUT
  • 60. Program No.33- To count the no. of vowels in the string INPUT OUTPUT
  • 61. Program No.34-To remove vowels from a string INPUT OUTPUT
  • 62. Tuples and Dictionary Tuples- Python tuple is a collection type data structure which is immutable by design and holds a sequence of heterogeneous elements. It functions almost like a Python list but with the following distinctions.  Tuples store a fixed set of elements and don’t allow changes whereas the list has the provision to update its content.  The list uses square brackets for opening and closing whereas, and a tuple has got parentheses for the enclosure. Dictionary- Dictionary in Python is a scrambled collection of objects. Unlike other data types such as a list or a set which has a single value field, the dictionary type stores a key along with its value.  The keys pair with values using a colon (:) while the commas work as a separator for the elements. Also, the entire dictionary object uses curly braces to enclose itself.
  • 63. Program No.35- To input 'n' names and phone numbers to store it in a dictionary and print the phone number of a particular name INPUT OUTPUT
  • 64. Program No.36- To input names of 'n' countries and their capital and currency, store it in a dictionary in tabular form. also search and display for a particular country. INPUT OUTPUT Program No.26- To find the prime no. from 2 to 100
  • 67. Program No.37-To input names of 'employees and their salary details like basic salary, house rent and conveyance allowance. cal. total salary of each employee and display INPUT OUTPUT
  • 68. SQL Structured Query language is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS). It is particularly useful in handling structured data, i.e. data incorporating relations among entities and variables. SQL offers two main advantages over older read–write APIs such as ISAM or VSAM. Firstly, it introduced the concept of accessing many records with one single command. Secondly, it eliminates the need to specify how to reach a record, e.g. with or without an index.
  • 69. Originally based upon relational algebra and tuple relational calculus, SQL consists of many types of statements, which may be informally classed as sublanguages, commonly: a data query language (DQL),[a] a data definition language (DDL),a data control language (DCL), and a data manipulation language (DML). The scope of SQL includes data query, data manipulation (insert, update and delete), data definition (schema creation and modification), and data access control. Although SQL is essentially a declarative language (4GL), it includes also procedural elements.
  • 70. 1 Query-Command for creating database 2 Query Command for using the database 3 Query-Command for creating table 4 Query-Command for showing the structure of table 5 Query-Command to show table present in database
  • 71. 6 Query-Command for inserting data into a table 7 Query-Command to view the contents of the table 8 Query-Command for retrieve data
  • 72. 9 Query Command for using keyword DISTINCT 10 Query-Command for using WHERE clause 11 Query-Command for using ORDER BY clause 12 Query-Command for using UPDATE
  • 73. 13 Query-Command for using ALTER (to modify structure of table) 14 Query-Command for using LIKE operator 15 Query-Command for using aggregate functions 16 Query-Command for using GROUP BY with COUNT 17 Query-Command for using Group by with Order By
  • 74. 18 Query-Command for equi-join of tables 19 Query-Command to retrieve data from two tables 20 Query-Command for using Group By clause in join 21 Query-Command for using where clause and group by 22 Query-Command to delete a column
  • 75. 23 Query-Command for using logical operators 24 Query-Command for using arithmetic operators 25 Query-Command for select data in range 26 Query-Command for using in condition
  • 76. 27 Query-Command to change data type of an existing column 28 Query-Command to delete table 29 Query- Command to join table using Cross Join (Cartesian product)
  • 77. 30 Query- Command to join table using Equi join 31 Query- Command to join table using Natural join
  • 78. WORKING WITH FUNCTION- Large programs are often difficult to manage, thus large programs are divided into smaller units known as functions. It is simply a group of statements under any name i.e. function name and can be invoked (call) from other part of program. Take an example of School Management Software, now this software will contain various tasks like Registering student, Fee collection, Library book issue, TC generation,
  • 79. Result Declaration etc. In this case we have to create different functions for each task to manage the software development.
  • 80. Program NO.-38- Passing dictionary to function with key and value, and update value at that key in dictionary INPUT
  • 82. Program No.-39- Creating a login program with the help of passing tuple to function INPUT OUTPUT
  • 83. Program No.-40- Passing list to function to calculate sum and average of all numbers and return it in the form of tuple INPUT OUTPUT
  • 84. Program No.-41- Passing list to function, and just double each value INPUT
  • 85. OUTPUT Program No.-42 Program to Jumble the given string by passing it to function using temporary string INPUT
  • 86. OUTPUT Program No.-43 Passing string to function and count how many vowels in it INPUT
  • 88. BINERY FILE HANDLING It stores the information in the same format as in the memory i.e. data is stored according to its data type so no translation occurs. In binary file there is no delimiter for a new line Binary files are faster and easier for a program to read and write than text files.
  • 89. Data in binary files cannot be directly read, it can be read only through python program for the same. Program No.-44 Program to search for name in binary file and display record number INPUT
  • 90. OUTPUT Program No.-45 Program to delete name from binary file INPUT
  • 91. OUTPUT Progam No.-46 Program to update name in Binary File
  • 93. Finding Number of Record in Binary File INPUT OUTPUT
  • 94. Program No.-48 Deleting Employee Record INPUT OUTPUT
  • 95. COMMA SEPARATEDVALUE CSV is a simple file format used to store tabular data, such as a spreadsheet or database. Files in the CSV format can be imported to and exported from programs that store data in tables, such as Microsoft Excel or OpenOffice Calc. CSV stands for "comma-separated values“. A comma-separated values file is a delimited text file that uses a comma to separate values. record consists of one or more fields,
  • 96. separated by commas. The use of the comma as a field separator is the source of the name for this file format Prgram No.-49 Program to Counting number of records INPUT OUTPUT
  • 97. Program No.-50 Program to get Sum of Salary and counting employee getting more than 7000 INPUT
  • 98. OUTPUT Program No.-51 Program to Write data to CSV file INPUT
  • 100. HANDLING Text file stores information in ASCII OR UNICODE character. In text file everything will be stored as a character for example if data is “computer” then it will take 8 bytes and if the data is floating value like 11237.9876 it will take 10 bytes. In text file each like is terminated by special character called EOL. In text file some translation takes place when this EOL character is read or written. In python EOL is ‘n’ or ‘r’ or combination of both
  • 101. Program No-52 Progam to read text file using read() INPUT OUTPUT
  • 102. Program No.-53 wap to add 2 more students of a class in a previously created file INPUT OUTPUT
  • 103. Program No.-54 wap to display contents of a previously created file INPUT OUTPUT
  • 104. Program No.-55 wap to display the size of files in bytes INPUT OUTPUT
  • 105. Program No.-56 wap to get informaion of students of a class and store these details in a file INPUT OUTPUT
  • 106. USING PYTHON LIBRARIES As our program become larger and more complex the need to organize our code becomes greater. We have already learnt in Function chapter that large and complex program should be divided into functions that perform a specific task. As we write more and more functions in a program, we should consider organizing of functions by storing them in modules A module is simply a file that contains Python code. When we break a program into modules, each modules should contain functions that perform related tasks. Commonly used modules that contains source code for generic needs are called Libraries.
  • 108. Program No.57 Program to convert numbr to octal and hexadecimal INPUT OUTPUT
  • 109. Program No.-58 Program to suare of no. using math module INPUT OUTPUT
  • 110. INTERFACE PYTHON WITH MYSQL Before we connect python program with any database like MySQL we need to build a bridge to connect Python and MySQL. To build this bridge so that data can travel both ways we need a connector called “mysql.connector”. We can install “mysql.connector” by using following methods: At command prompt (Administrator login) Type “pip install mysql.connector” and press enter n “https://dev.mysql.com/downloads/connector/python/” and download connector as per OS and Python version
  • 111. Program No.-61 Program to establish connection with MySQL INPUT OUTPUT
  • 112. Program No.-62 Program to get all data using fetchall() INPUT OUTPUT
  • 113. Program No.-63 Program to get only one record using fetchone() INPUT OUTPUT
  • 114. Program No.-64 Program to get multiple records using fetchmany() INPUT OUTPUT
  • 115. Program No.-65 Concatenating variable with query INPUT OUTPUT
  • 116. Program No.-66 String template with %s formatting INPUT
  • 117. OUTPUT Program No.-67 String template with {} and format()
  • 119. Program to insert data INPUT OUTPUT
  • 120. Program No.-69 Program to Update record INPUT OUTPUT
  • 121. STACK  A stack is a collection of data items that can be accessed at only one end, called top.  Items can be inserted and deleted in a stack only at the top.  The last item inserted in a stack is the first one to be deleted.
  • 122.  Therefore, a stack is called a Last-In-first-Out (LIFO) data structure.  2 mains operations on Stack is PUSH &POP  PUSH means inserting new item at top and POP means deleting item from top. Program No.-71 Write a menu based program to demonstrate operation on a stack INPUT
  • 124. OUTPUT
  • 125. QUEUE  Queue is a linear list which follows FIFO approach.  Queue allows addition of element only at one end called REAR (end of list) & Deletion of element only from FRONT end (beginning of list).
  • 126.  The operation of addition and deletion is known as Enqueue and Dequeue respectively.  Applications of Queue: oPrinter Spooling oCPU Scheduling oMail Service oKeyboard Buffering oElevator Program No.-71 Write a menu based program to demonstrate operations on queue INPUT
  • 128. OUTPUT