IP Practicle

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

PROGRAM #1

Write a python program to find average and grade for given marks.

Source Code:

Output:
PROGRAM #2

Write a python program to find sale price of an item with given cost and discount (%)

Source Code:

Output:
PROGRAM #3

Write a python program to calculate perimeter/circumference and area of shapes such as triangle, rectangle,

Square and circle.

Source Code:
Output:
PROGRAM #4

Write a python program to calculate Simple and Compound interest.

Source Code:

Output:
PROGRAM #5

Write a python program to calculate Simple and Compound interest.

Source Code:

Output:
PROGRAM #6

Write a python program to calculate EMI for amount, period and interest

Source Code:

Output:
PROGRAM #7

Write the Python program to calculate tax - GST/ income tax

Source Code:

Output:
PROGRAM #8

Write the Python program to find the largest and smallest numbers in a list

Source Code:

Output:
PROGRAM #9

Write the Python program to find the third largest/smallest number in a list.
PROGRAM #10

Write the Python program to find sum of squares of the first hundred natural numbers

Source Code:

Output:

PROGRAM #11

Write the Python program to print the first ‘n’ multiples of a given number
Source Code:

Output:

PROGRAM #12

Write the Python program to count the number of vowels in a user entered string
Source Code:

Output:

PROGRAM #13

Write the Python program to print the words starting with a particular alphabet in a
user entered string.
Source Code:

Output:

PROGRAM #14

Write the Python program to print number of occurrences of a given alphabet in each
string.
Source Code:

Output:

PROGRAM #15

Write the Python program to create a dictionary to store names of states and their
capitals.

Source Code:
Output:

PROGRAM #16

Write the Python program to create a dictionary of students to store names and marks
obtained in 5 subjects.

Source Code:
Output:

PROGRAM #17

Write the Python program to print the highest and lowest values in the dictionary.
Source Code:

Output:

SQL Command #1:

Write MySQL Command to create a database:

Command:
Create database School2023;

SQL Command #2:

Write MySQL Command to create student table with the student id, class, section, gender, name, DOB, and

Marks as attributes where the student id is the primary key:

Command:
create table
student( studentID int(4)
primary key, class char(2),
section char(1),
Gender char(1),
name varchar(20),
dob date,
marks decimal(5,2));

SQL Command #3:

Write MySQL Command to insert the details of at least 10 students in the above table:

Command:
insert into student values
(1001,'XI','K','M','Anas','2005/12/23',88.21),
(1002,'XI','K','M','Yaser','2005/03/24',77.90),
(1003,'XI','L','M,'Arshad','2006/04/21',76.20),
(1004,'XI','L','M','Farhan','2005/09/15',68.23),
(1005,'XI','K','M','Joe','2005/08/23',66.33),
(1006,'XI','L','M','Ismail,'2005/10/27',62.33),
(1007,'XI','K','M','Zahed,'2005/01/23',84.33),
(1008,'XI','L','M','Ayush','2005/04/23',55.33),
(1009,'XI','K','M','Ahmed','2005/06/01',74.33),
(1010,'XI','K','M','Sahil','2005/10/19',72.30);
SQL Command #4:

Write MySQL Command to display the entire content of table.

Command:
select * from student;

SQL Command #5:

Write MySQL Command to display Studentid, Name and Marks of those students who are scoring marks
more than 50:

Command:
select studentid,name,marks from student where marks>50;
SQL Command #6:

Write MySQL Command to find the average of marks from the student table:

Command:
select avg(marks) from student;

SQL Command #7:

Write MySQL Command to find the number of students, who are from section ‘K’:

Command:

select count(*) from student where section = 'K'

SQL Command #8:

Write MySQL Command to display the information all the students, whose name starts with ‘AN’ (Examples:

ANAND, ANGAD,..):

Command:
select * from stduent where name like 'an%';
SQL Command #9:

Write MySQL Command to display Rno, Name, DOB of those students who are born between ‘2005- 01-01’
and ‘2005-12-31’.

Command:
select studentif, name, dob from student where dob beetween '2005-01-01'
and '2005-12-31';

SQL Command #10:

Write MySQL Command to display Rno, Name, DOB, Marks, Email of those male students in ascending order
of their names.

Command:

select studentid, name, dob from student order by name;

SQL Command #11:

Write MySQL Command to display Rno, Gender, Name, DOB, Marks, Email in descending order of their
marks.

Command:
select studentid, gender, name, dob, marks from student order by marks desc; .
SQL Command #12:

Write MySQL Command to display the unique section available in the table.

Command:
select distnict section from student;

You might also like