Professional Documents
Culture Documents
CS Practical File
CS Practical File
Practical File
2021-2022
Shailendra kumar
RPVV INA Colony
Class XII-A
Roll no. 17
Rajkiya Pratibha Vikas
Vidyalaya
Certificate
“Computer Science Practical file session 2021-2022“
Signature of Examiner
INDEX
SL Name of Date of Date of
NO. Practical Practica Submission Remarks
l s
1. Write a program to
implement a stack
using list.
3. Update command in
MySQL
4. To order by table in
ascending/descending
order
5. To perform delete
command in MySQL
6. Joins in MySQL
Practical 1
Aim: Write a program to implement a stack using list.
Program:
# push element
def push(list, element):
list.append(element)
return list
# pop element
def pop(list):
a = list.pop()
return list, " element popped... ", a
# peek element
def peek(list):
return "peek element: ", list[-1]
# display elements
def display(list):
l = len(list)
for i in range(l - 1, -1, -1):
print(list[i])
# __main__
stack = []
run = True
while run:
ask = int(input("1. push element \n"
"2. pop element\n"
"3. peek element\n"
"4. display elements \n"
"5. quit\n"
"enter your choice:\n".title()))
if ask == 1:
a = int(input("enter element to push in to stack:\n"))
print(push(stack, a), "\n")
if ask == 2:
if len(stack) == 0:
print("Empty Stack..\n")
else:
print(pop(stack), "\n")
if ask == 3:
print(peek(stack), "\n")
if ask == 4:
display(stack)
print("")
if ask == 5:
run= False
Output:
Practical 2
Alter table
alter table xii_a_student_personal_detail add column behavior varchar(10);
alter table xii_a_student_personal_detail drop column behavior;
Practical 3
Table
Program:
● Inner join
select * from pc;
select * from record;
select * from record as r inner join pc on r.name=pc.name;
● Natural join
Select * from record natural join pc;