Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

COMPUTER SCIENCE

PROGRAM FILE
Submitted
By
VAIBHAV ARORA
XII - H
BOARD ROLL NO.

-------------------------------------------
Under the Guidance of
Mr. Arun Khanna
(Computer Science Teacher)
INDEX
S.NO TOPIC SIGNATURE
1 Write an algorithm to
pop an element into
the Stack
2 Write an interactive
menu-driven program
to implement Stack
using list. The list
contains the names of
students.

3 Write a python
program to maintain
book details like book
code, book title and
price using stacks data
structures?
(implement push (), pop
() and traverse ()
functions)
4 Write a program that
depending upon the
user’s choice, either
adds or removes an
element from a stack.
5 Write a function in
python, AddEmp(stk)
and DelEmp(stk) to add
a new employee id and
name and delete the
employee, considering
them to act as push and
pop operation of the
stack data structure.

6 . creating a database in
python using mysql
python connectivity

7 Creating table in python


using mysql python
connectivity.
8 showing the table
content using mysql
python connectivity.
9 Describe table using
mysql python
connectivity

10 write a program to
demonstrate add,
display, exit performed
on a table movie
containing Mcode,
name, rating through
mysql python
connectivity.
11 Fetching data without
using Pandas dataframe
and using mysql python
connectivity.

12 showing no of
databases created using
python my sql
connectivity
Q1 Write an algorithm to pop an element into
the Stack.

Output-:
Q2 Write an interactive menu-driven program
to implement Stack using list. The list contains
the names of students.

Output-:
Q3 Write a python program to maintain book details like
book code, book title and price using stacks data structures?
(implement push (), pop () and traverse () functions)
Output-:
Q4 Write a program that depending upon the user’s choice,
either adds or removes an element from a stack.

Output-:
Q5 Write a function in python, AddEmp(stk) and DelEmp(stk)
to add a new employee id and name and delete the
employee, considering them to act as push and pop
operation of the stack data structure.

Output-:
Q6. creating a database in python using mysql python connectivity

Code:-

Output:-
Q7. Creating table in python using mysql python connectivity.

Code:-

import mysql.connector

mydb=mysql.connector.connect(host='localhost',user='root',password='laxmi
nagar',database='lps69')

mycursor=mydb.cursor()

mycursor.execute('CREATE TABLE STUDENT \

(ROLLNO INTEGER(3),\

NAME VARCHAR(20),\

AGE INTEGER(10));')

Output:-
Q8. showing the table content using mysql python connectivity.

Code:-

import mysql.connector

mydb=mysql.connector.connect(host='localhost',user='root',password='laxmi
nagar',database='lps69')

mycursor=mydb.cursor()

mycursor.execute('show tables')

for x in mycursor:

print(x)

output:-
Q9. Describe table using mysql python connectivity

Code:-

import mysql.connector

mydb=mysql.connector.connect(host='localhost',user='root',password='laxmi
nagar',database='lps69')

mycursor=mydb.cursor()

mycursor.execute('desc student')

for x in mycursor:

print(x)

Output:-
Q10 write a program to demonstrate add, display, exit performed on a table
movie containing Mcode, name, rating through mysql python connectivity.

Code:-

Output:-
Q11 Fetching data without using Pandas dataframe and using mysql python
connectivity.

Code:-

Output:-
Q12 showing no of databases created using python my sql connectivity

Code:-

import mysql.connector

mydb=mysql.connector.connect(host='localhost',user='root',password='laxminagar')

mycursor=mydb.cursor()

mycursor.execute('show databases')

for i in mycursor:

print(i)

output:-

You might also like