Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-01
Q1. Write a program that reads an integer value and prints -leap year or -not a leap year.
CODING:-
Year=int(input("Enter the number:"))
if((Year%400==0)or(Year%100!=0)and(Year%4==0)):
print("Given Year is a leap Year");
else:
print("Given Year is not a leap Year")
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 1
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-02
Q2. Write a program to create the following Pattern
For example enter a size: 5
*
**
***
****
*****
CODING:-
n=int(input("Enter the number:"))
for n in range(1,n+1):
for m in range(1,n+1):
print("*",end='')
print("")
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 2
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-03
Q3. Write a function that takes an integer input and calculates the factorial of the
number.
CODING:-
num=int(input("Enter a number:"))
factorial=1
if num<0:
print("Sorry,factorial does not exist for negative numbers")
elif num==0:
print("The factorial of 0 is 1")
else:
for i in range(1,num+1):
factorial=factorial*i
print("The factorial of",num,"is",factorial)
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 3
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-04
Q4. Write a function that takes a string input and checks if it is a palindrome or not.
CODING:-
def isPalindrome(s):
return s==s[::-1]
s=input("Enter string:")
ans=isPalindrome(s)
if ans:
print("String is Palindrome")
else:
print("String is not palindrome")
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 4
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-05
Q5. Write a program to check whether the input number is even or odd.
CODING:-
num = int(input("Enter any number:"))
if(num%2)==0:
print("The number is even")
else:
print("The number is odd")
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 5
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-06
Q6. Write a program to generate Fibonacci series.
CODING:-
nterms=int(input("How many terms?"))
n1,n2=0,1
count=0
if nterms<=0:
print("please enter a positive integer")
elif nterms==1:
print("Fibonacci sequence upto",nterms,":")
print(n1)
else:
print("Fibonacci sequence:")
while count<nterms:
print(n1)
nth=n1+n2
n1=n2
n2=nth
count+=1
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 6
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-07
Q7. Write a program to compare three numbers and print the largest one.
CODING:-
num1=int(input("Enter first number:"))
num2=int(input("Enter second number:"))
num3=int(input("Enter third number:"))
if(num1>=num2)and(num1>=num3):
largest=num1
elif(num2>=num1)and(num2>=num3):
largest=num2
else:
largest=num3
print("The largest number is",largest)
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 7
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-08
Q.8 Write a program to print factors of a given number.
CODING:-
num=int(input("enter a number"))
factors=[]
for i in range(1,num+1):
if num%i==0:
factors.append(i)
print("Factors of{}={}".format(num,factors))
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 8
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-09
Q.9 Write a program to sort a list using bubble sort.
CODING:-
arr=[20,9,6,3,1]
n=len(arr)
for i in range(n-1):
for j in range(n-1-i):
if arr[j]>arr[j+1]:
arr[j], arr[j+1]=arr[j+1],arr[j]
print('Array after sorting')
print(arr)
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 9
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-10
Q.10 Write a program to sort a list using Selection sort.
CODING:-
arr=[20,9,16,3,5]
n=len(arr)
for i in range(n-1):
pos_smallest=i
for j in range(i+1,n):
if arr[j]<arr[pos_smallest]:
pos_smallest=j
arr[i],arr[pos_smallest]=arr[pos_smallest],arr[i]
print('Array after sorting')
print(arr)
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 10
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-11
Q.11 Write a program to sort a list using Insertion sort.
CODING:-
arr=[20,9,16,3,5]
n=len(arr)
for i in range(1,n):
temp=arr[i]
j=i-1
while(j>=0 and temp<arr[j]):
arr[j+1]=arr[j]
j-=1
arr[j+1]=temp
print('Array after sorting')
print(arr)
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 11
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-12
Q.12 Write a program to implement linear search on list.
CODING:-
def LinearSearch(array,n,k):
for j in range(0,n):
if(array[j]==k):
return j
return-1
array=[1,3,5,7,9]
k=7
n=len(array)
result=LinearSearch(array,n,k)
if(result==-1):
print("Element not found")
else:
print("Element found at index:",result)
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 12
Programming in Python ||2023-24
_______________________________________________________________________________________________
ASSIGNMENT-13
Q.13 Write a program to implement binary search on list.
CODING:-
def binarySearch(arr,k,low,high):
while low<=high:
mid=low+(high-low)//2
if arr[mid]==k:
return mid
elif arr[mid]<k:
low=mid+1
else:
high=mid-1
return-1
arr=[1,3,5,7,9]
k=5
result=binarySearch(arr,k,0,len(arr)-1)
if result!=-1:
print("Element is present at index"+str(result))
else:
print("Not found")
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 13
Programming in SQL || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-01
1.Student(sid,sname,sad,sphn,dob)
1. Create the given table.
2. Insert at least five rows.
3. Display the table.
4. Add one more column as ‘department’.
Roopali sahu PGDCA(2ND SEM) Page 14
Programming in SQL || 2023-24
_______________________________________________________________________________________________
5. Insert values in department.
6. Modify the value 1004 as 1005.
7. List all the student008 whose dob is between’01-jan-1995’ to ’31-dec-1995’.
Roopali sahu PGDCA(2ND SEM) Page 15
Programming in SQL || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-02
2.College(cid,cname,city,phn)
1.Create the above table with following specification. Cid=primary key.
2. Insert at least five rows.
3. Describe the table.
Roopali sahu PGDCA(2ND SEM) Page 16
Programming in SQL || 2023-24
_______________________________________________________________________________________________
4. Find the details of college.
5. Add one more column as aff_date.
Roopali sahu PGDCA(2ND SEM) Page 17
Programming in SQL || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-03
3.Draw a Table Client Master in SQL:-
*Creating a table:-
create table client_master02(client_number varchar2(6),name varchar2(15),city varchar2(15),pincode
number(10),state varchar2(12),balance number(10,2));
*Insert the value of a table:-
insert into client_master02 values(1001,'Nisha','Rajnandgaon',491441,'chhattisgarh',11000);
insert into client_master02 values(1002,'Dipika','Durg',491001,'chhattisgarh',21000);
insert into client_master02 values(1003,'Laxmi','Raipur',490042,'MP',41000);
insert into client_master02 values(1004,'Rita','korba',495450,'chhattisgarh',51000);
insert into client_master02 values(1005,'Kavya','Raigarh',496001,'MP',40000);
Roopali sahu PGDCA(2ND SEM) Page 18
Programming in SQL || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-04
4.Draw a Table Product Master in SQL:-
*Create a table:-
create table product_master(product_number varchar2(8),description varchar2(10),profit_number
number(4,2),qty_on_hand number(8),r_lvl number(8),sell_price number(10),cost_price number(8,2));
*Insert the value of a table:-
insert into product_master values('1','bags',34,6,78,799,899);
insert into product_master values('2','shoes',45,5.6,80,599,199);
insert into product_master values('3','book',23,8,12,439,68);
insert into product_master values('4','mobile',39,03,40,599,999);
insert into product_master values('5','foods',09,43,90,299,590);
Roopali sahu PGDCA(2ND SEM) Page 19
Programming in SQL || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-05
5.Draw a Table Supplier Master in SQL:-
*Create a table:-
create table supplier_master(supplier_number varchar2(6),supplier_name varchar2(20),address
varchar2(30),city varchar2(10),pin_code number(10));
*Insert the value of a table:-
insert into supplier_master values('1','dolly','surgi','rjn',491441);
insert into supplier_master values('2','Manisha','Potiya','durg',491221);
insert into supplier_master values('3','Ram','Bhedi','balod',491441);
insert into supplier_master values('4','Hemant','Manki','rjn',491441);
insert into supplier_master values('5','Shyam','Hirri','durg',491221);
Roopali sahu PGDCA(2ND SEM) Page 20
Programming in SQL || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-06
6.Draw aTable Employee in SQL:-
*Create a table:-
create table emp03(emp_number varchar2(5),emp_name varchar2(10),desigination
varchar2(15),department_number number(5),salary number(10),join_date varchar(20));
*Insert the value of a table:-
insert into emp03 values('1','Kavya','manager',12,50000,'28/03/2022');
insert into emp03 values('2','Vishal','doctor',09,75000,'20/03/2022');
insert into emp03 values('3','Shobha','teacher',02,20000,'26/03/2022');
insert into emp03 values('4','Sonam','Police',01,50000,'12/07/2017');
insert into emp03 values('5','Kajal','professor',04,80000,'28/03/2017');
Roopali sahu PGDCA(2ND SEM) Page 21
Programming in SQL || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-07
7.Draw a Table Salesman in SQL:-
*Create a table:-
create table salesman(salesman_number varchar2(10),salesman_name varchar2(15),address1
varchar2(30),address varchar2(30),city varchar2(10),pin_code number(8),sell_amt number(6),tgt_to_get
number(6),ytd_sales number(6),remark varchar2(10));
*Insert the value of a table:-
insert into salesman values('01','Payal','raipur','Tirga','raipur',490031,999,456,199,'good');
insert into salesman values('02','Megha','durg','Potiya','durg',491221,499,343,699,'verygood');
insert into salesman values('03','Sanju','rjn','Manki','rjn',491441,99,34,199,'nice');
insert into salesman values('04','Priti','raipur','Khuteri','raipur',490031,199,303,299,'verygood');
insert into salesman values('05','Shiva','raipur','somni','raipur',490031,899,83,699,'good');
Roopali sahu PGDCA(2ND SEM) Page 22
Programming in SQL || 2023-24
_______________________________________________________________________________________________
QUERIES
1.Find out the name of all the Client from Client_Master table:-
SQL> Select Name from client_master02;
2.Retrieve the list of name and city of all Client_Master table:-
SQL> Select Name,City from client_master02;
3.List of the Client whose location is Durg:-
SQL> Select Name from client_master02 where City='Durg';
4.Change the balance of Client number 1001 to rupees 65000:-
SQL> Update client_master02 set balance='65000' where client_Number=1001;
Roopali sahu PGDCA(2ND SEM) Page 23
Programming in SQL || 2023-24
_______________________________________________________________________________________________
5.Display the table Client_Master Among with its data:-
SQL> Select *from client_master02;
6.Delete from Client_Master where the value of state is ‘chhattisgarh’:-
SQL> Delete from client_master02 where state='chhattisgarh';
SQL> Select*from client_master02;
7.Find the name of the salesman whose sell_amt=899:-
SQL> Select salesman_name from salesman where sell_amt=899;
Roopali sahu PGDCA(2ND SEM) Page 24
Programming in SQL || 2023-24
_______________________________________________________________________________________________
8.Change the city of the salesman whose city is rjn:-
SQL> Update salesman set city='bhilai' where city='rjn';
SQL> Select*from salesman;
9.Change the name of salesman table to Roopali:-
SQL> Rename salesman to Roopali;
10.Select data from employee table who are not working in department_Number(9,2,4):-
SQL> Select*from emp03 where department_number not in(9,2,4);
Roopali sahu PGDCA(2ND SEM) Page 25
Programming in SQL || 2023-24
_______________________________________________________________________________________________
11.Select data from emp who are teacher or professor:-
SQL> Select*from emp03 where desigination in('teacher','professor');
12.List the name of employee who join date in (‘12/07/17’):-
SQL> Select emp_name from emp03 where join_date in('12/07/2017');
13.Display emp_name having the length of 6 characters:-
SQL> Select emp_name from emp03 where length(emp_name)=6;
14.List all employee name ending with l:-
SQL> Select emp_name from emp03 where emp_name like'%l';
Roopali sahu PGDCA(2ND SEM) Page 26
Programming in SQL || 2023-24
_______________________________________________________________________________________________
15.Display the name of the employee who are working teacher,doctor,police salary is
greater 2500:-
SQL> select emp_name from emp03 where desigination in('teacher','doctor','police')and(salary>45000);
16.Retrieve all information about supplier whose name begin with ‘do’ from
supplier_master:-
SQL> Select * from supplier_master where supplier_name like'do%';
17.Retrieve the supplier_name where second character of name is ‘ a%’:-
SQL> Select supplier_name from supplier_master where supplier_name like'_a%';
18.Retrieve the supplier_master whose supplier_number second character has 5:-
SQL> Select*from supplier_master where supplier_number like'5%';
19.Retrieve the city from supplier_master where second character is u:-
SQL> Select city from supplier_master where city like'_u%';
Roopali sahu PGDCA(2ND SEM) Page 27
Programming in SQL || 2023-24
_______________________________________________________________________________________________
20.List the various product available from product_master table:-
SQL> Select description from product_master;
21.Change the cost_price of 68 to rupees 788:-
SQL> Update product_master set cost_price=788 where description='book';
SQL> Select*from product_master;
22.Change the size of sell_price column in product_master(12,2):-
Roopali sahu PGDCA(2ND SEM) Page 28
Programming in SQL || 2023-24
_______________________________________________________________________________________________
SQL> Alter table product_master modify(sell_price number(12,2));
23.Delete all product from product_master where qty_on_hand =8:-
SQL> Delete from product_master where qty_on_hand=8;
SQL> Select*from product_master;
24.Select from emp_name where mid character is n:-
SQL> Select*from emp where emp_name like'V%';
25.Display the name of current user:-
SQL> Show User;
Roopali sahu PGDCA(2ND SEM) Page 29
Programming in HTML || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-01
Q1. Write a program to create a Unordered List.
CODING:-
<html>
<head><title>unordered list</title></head>
<body>
<!---heading tags--->
<h1>Nested Unordered List</h1>
<h2>GeeksForGeeks courses List</h2>
<ul type="dot">
<li> DSA</li>
<ul type="circle">
<li> Array</li>
<li>Linked</li>
<li>Stack</li>
<li>Queue</li>
</ul>
<li>Web Technologies</li>
<ul type="circle">
<li>HTML</li>
<li>CSS</li>
<li>Java Script</li>
</ul>
<li>Apptitude</li>
<li>Gate</li>
<li>Placement</li>
</ul>
</body>
</html>
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 30
Programming in HTML || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-02
Q.2 Write a program to create a Ordered List.
CODING:-
<html>
<head><title>Ordered List</title></head>
<body>
<!---heading tags--->
<h1> Nested Ordered List</h1>
<ol>
<li>Reserved Attibute</li>
<ol type="I">
<li>HTML</li>
<li>Css</li>
<li>Js</li>
</ol>
<li>Start Attribute</li>
<ol type="i">
<li>HTML</li>
<li>Css</li>
<li>Js</li>
</ol>
<li>Type Attribute</li>
<ol type="1">
<li>HTML</li>
<li>Css</li>
<li>Js</li>
</ol>
</ol>
Roopali sahu PGDCA(2ND SEM) Page 31
Programming in HTML || 2023-24
_______________________________________________________________________________________________
</body>
</html>
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 32
Programming in HTML || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-03
Q.3 Wtite a program to describe Text Formatting.
CODING:-
<html>
<head><title>Text formatting</title></head>
<body>
<b> this text is bold</b><br>
<i> this text is italic</i><br>
<h2><mark>Text formatting </mark></h2><br>
My favorite<ins>color</ins>is<del>RED</del>blue.<br>
<em> this text is emphasis</em><br>
<strong> this text is more Strong</strong>
<p>new paragraph</p>
we have to learn much more formatting<br>
<big>big size</big>
<small> small size text</small><br><hr>
<big>H<sub>2</sub>O</big>
<br>(a+b)<sup>2</sup>=a<sup>2</sup>+2ab+b<sup>2</sup>
<br><strong><center>OR</center></strong>
2<sup>2</sup>=4
<pre>So go ahead,enjoy learning</pre>
</body>
</html>
Roopali sahu PGDCA(2ND SEM) Page 33
Programming in HTML || 2023-24
_______________________________________________________________________________________________
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 34
Programming in HTML || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-04
Q.4 Write a program to create a following Table.
CODING:
<html>
<style>
table th,td
{border:1px solid black;
border-collapse:collapse;}
</style>
<center>
<table>
<tr>
<tr>
<th>Class</th>
<th>Subject1</th>
<th>Subject2</th>
<th>Subject3</th>
</tr>
<tr>
<th>BCA I</th>
<td>Visual Basic</td>
<td>PC Software</td>
<td>Electronics</td>
</tr>
<tr>
<th>BCA II</th>
<td>C++</td>
<td>DBMS</td>
<td>English</td>
</tr>
<tr>
Roopali sahu PGDCA(2ND SEM) Page 35
Programming in HTML || 2023-24
_______________________________________________________________________________________________
<th>BCA III</th>
<td>Java</td>
<td>Multimedia</td>
<td>CSA</td>
</tr>
</tr>
</center>
</table>
</html>
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 36
Programming in HTML || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-05
Q.5 Write a program to create a following Table.
CODING:-
<html>
<style>
table th,td
{border:1px solid black;
border-collaps:collaps;}
</style>
<table>
<tr>
<th align="left">Course</th>
<th>OC</th>
<th>BC</th>
<th>MBC</th>
<th>SC/ST</th>
<th>TOTAL</th>
</tr>
<tr>
<th alignment="left">Computer Science</th>
<td>9</td>
<td>18</td>
<td>5</td>
<td>5</td>
<td>37</td>
</tr>
<tr>
<th alignment="left">Commerce</th>
<td>14</td>
<td>25</td>
<td>6</td>
Roopali sahu PGDCA(2ND SEM) Page 37
Programming in HTML || 2023-24
_______________________________________________________________________________________________
<td>5</td>
<td>50</td>
</tr>
<tr>
<th alignment="left"colspan="5">Grand Total</th>
<td>87</td>
</tr>
</table>
</html>
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 38
Programming in HTML || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-06
Q3. Write an HTML Program to demonstratre hyperlinking between two web pages.
Create a marquee and also insert an image.
CODING:-
<html>
<head><title>Hyperlink</title></head>
<body>
<h3><marquee><a href="table.html">click for table</a></h3>
<!--anchor Hyertext Reference>
</body>
</html>
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 39
Programming in HTML || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-07
Q4. Write a program insert an image.
CODING:-
<html>
<head><title>image</title>
</head>
<body>
<img src="C:\Users\LENOVO\Desktop\RS\party.jpg">
<!---image source>
</body>
</html>
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 40
Programming in HTML || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-08
Q.8 Write a program to describe the concept of frameset.
CODING:-
<!Program for frameset>
<html>
<head><title>frameset</title></head>
<frameset cols="30%,30%,40%">
<frame src="ima1.html">
<frame src="ima2.html">
<frame src="ima3.html">
</frameset>
</html>
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 41
Programming in HTML || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-09
Q.9 Write an HTML program to create a web page with a blue background and the
following list.
New Delhi
New Delhi,the capital and the third largest city of india is a fusion of the ancient and the
modern. The refrains of the muslim dynasties with its architectural delights.Give the
najestic ambience of the bygone era.
CODING:-
<html>
<head><title>paragraph</title>
<body bgcolor="blue">
<i><u>
<h1 align="center">New Delhi
</h1></u>
<p>
New Delhi,the capital and the third largest city of india is a fusion of the ancient and the modern.The
refrains of the muslim dynasties with its architectural delights.Give the majestic ambience of the bygone
era.
</p>
</i>
</body>
</html>
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 42
Programming in HTML || 2023-24
_______________________________________________________________________________________________
ASSIGNMENT-10
Q.10 Write a program to create a following form.
CODING:-
<html>
<head>
<title>form</title>
</head>
<body>
<form>
Enter First Name:<input type="text"><br>
Enter Last Name:<input type="text"><br>
Enter Fathe's Name:<input type="text"><br>
User Name:<input type="text"><br>
Password:<input type="password"><br>
When user types characters in password field,
the browser displays asterisks or bollets instead of characters.
<input type="submit"value="SUBMIT">
</form>
</body>
</htmi>
Roopali sahu PGDCA(2ND SEM) Page 43
Programming in HTML || 2023-24
_______________________________________________________________________________________________
OUTPUT:-
Roopali sahu PGDCA(2ND SEM) Page 44