0% found this document useful (0 votes)
8 views

PROGRAMS Class 12 Python Computer Science

Class 12 programs python

Uploaded by

rizephoenix001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

PROGRAMS Class 12 Python Computer Science

Class 12 programs python

Uploaded by

rizephoenix001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

PROGRAMS

 PROGRAM 1 ~ write a program to print a series of numbers


which are divisible by 2.
 PROGRAM 2 ~ Write a program to enter two numbers and find
their difference.
 PROGRAM 3 ~ Write a program to generate prime numbers up
to ‘n’ terms. Take the value of n from the user.
 PROGRAM 4 ~ write a program to write and display all the
Armstrong numbers between 1 and 200.
 PROGRAM 5 ~ Write a program to print the following Pyramind:
1
3 2
6 5 4
10 9 8 7

 PROGRAM 6 ~ Write a program to count the frequency of


elements in a list entered by the user.
 PROGRAM 7 ~ Write a python program to search an element
with its index number.
 PROGRAM 8 ~ Write a program to read 10 bytes from text file
‘detail.txt’.
 PROGRAM 9 ~ Write a program to check the position position of
file pointer after the first line and print the data of current
position.
 PROGRAM 10 ~ Write a program to read a text file and display
the count of upper case and lower case letters in the file.
 PROGRAM 11 ~ Create a program to create a stack for storing
only odd numbers out of all the numbers entered by the user.
 PROGRAM 12 ~ Write a program to implement Queue in python
using list.
 PROGRAM 13 ~ Write a program to read a given CSV file having
tab delimiter.
 PROGRAM 14 ~ Write a method in python to read lines from a
text file ‘INDIA.TXT’, to find and display the occurrence of the
word “India”.

---------------------------------INDIA.TXT-----------------------------------
“India is the fastest growing economy.
India is looking for more investments around the globe.
Whole world is looking at India as a great market.
Most of the Indians can foresee the heights that India is capable
Of reaching.”
--------------------------------------------------------------------------------------------

 PROGARM 15 ~ Write a program to create a CSV file to store


data (Roll no., Name, Marks). Obtained data from the user.
 PROGARM 16 ~ Write a query to display employee name and
salary of those who don’t have their salary in the range of 2500
and 4000.
Table: employees
EMPNo. Name Job Salary
1 Rohan Manager 4500
2 Priya salesmen 2000
3 Raj salesmen 3000

 PROGRAM 17 ~ create following table using SQL code:

Table: employees
No Name Age Department Date of Basic Sex
join
1 Narendra 45 Chemistry 13/02/88 10500 M
2 Naman 26 Computer 12/7/23 9500 M
3 Raj 50 Mathematics 25/8/96 8900 M
4 Amar 65 English 7/02/24 9000 M

 PROGRAM 18 ~ Create table employee with following structure:


Name of ID First Name Last name User id salary
column
type Number(4) Varchar(30) Varchar(30) Varchar(10) Number(9,2)

 PROGRAM 19 ~ Write a program to display the records from


table ‘employees’ (from program -17) in alphabetical as per
name of the employees.
 PROGRAM 20 ~ Program to connect with database and search
employee number in table employee and display record, if
empno. not found display appropriate message.

--------------------------------------------------------------------------------------------

# PROGRAM 1

OUTPUT:
PROGRAM 2:

OUTPUT :

PROGRAM 3:
OUTPUT:

PROGRAM 4:

OUTPUT:
PROGRAM 5:

OUTPUT:

PROGRAM 6:
OUTPUT:

PROGRAM 7:
OUTPUT:

PROGRAM 8:

PROGRAM 9:
OUTPUT:

PROGRAM 10:
OUTPUT:

PROGRAM 11:
OUTPUT:

PROGRAM 12:

OUTPUT:
PROGRAM 13:

OUTPUT:
PROGRAM 14:

OUTPUT:

PROGRAM 15:
OUTPUT:
PROGRAM 16:

OUTPUT:

PROGRAM 17:

PROGRAM 18:
PROGRAM 19:

OUTPUT:

PROGRAM 20:
OUTPUT:

And if the employee does not exist:

You might also like