0% found this document useful (0 votes)
37 views53 pages

Ip Record Programs Class 11

The document provides detailed instructions for writing an IP record notebook, specifying color codes for different sections and content. It includes multiple Python programming exercises with aims, methods, programs, and results for tasks such as calculating averages, areas, interests, and managing dictionaries. Each exercise concludes with a result statement confirming successful execution.

Uploaded by

bentenkabaap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views53 pages

Ip Record Programs Class 11

The document provides detailed instructions for writing an IP record notebook, specifying color codes for different sections and content. It includes multiple Python programming exercises with aims, methods, programs, and results for tasks such as calculating averages, areas, interests, and managing dictionaries. Each exercise concludes with a result statement confirming successful execution.

Uploaded by

bentenkabaap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

IMPORTANT INSTRUCTIONS TO BE NOTED BEFORE WRINTING

IP RECORD NOTE BOOK

 Write the content of record in the same color as give in the softcopy.
 Topic, expt.no, date(don’t write the date now;just leave it as empty), all
sub headings, program ---- in BLACK INK
 Content that I have given in blue, write in BLUE INK.
 RIGHT HAND SIDE:
1) TOPIC(black)
2) AIM(black)(Write content of aim in blue)
3) METHOD(black) (Write content of method in blue)
4) PROGRAM(Just as shown in the softcopy, try to write in
middle of the page) (black) Write complete program in black)
5) RESULT(should be written in the last lines of the page) (Write
content of result in blue)

 LEFT HAND SIDE:

WHATEVER WRITTEN ON LEFT HAND SIDE SHOULD BE WRITTEN


ONLY IN PENCIL.(Data of table,drawing table,output, heading of output….
Whatever it is…. Touch left side only and only in pencil) with dark colored
pencil. Handwriting should be legible)
1) OUTPUT
2) TABLES(IF ANY)
1. FIND AVERAGE AND GRADE FOR GIVEN MARKS.
AIM:
To write a python program to find average and grade for given marks.
METHOD:
Python
PROGRAM:
eng=float(input("Enter English Marks:"))
cs=float(input("Enter Computer Science Marks:"))
phy=float(input("Enter Physics Marks:"))
chem=float(input("Enter Chemistry Marks:"))
maths=float(input("Enter Mathematics Marks:"))
average=float((eng+cs+phy+chem+maths)/5)
print("Average of Marks is",average)
if average>90:
print("You scored GRADE A")
elif average<=90 and average >80:
print("You scored GRADE B")
elif average<=70 and average <80:
print("You scored GRADE C")
elif average<=60 and average <70:
print("You scored GRADE D")
elif average<=50 and average <60:
print("You scored GRADE E")

RESULT:
Thus the python program to find average and grade for given marks was
created and executed successfully.
OUTPUT:
2. Find sale price of an item with given cost and discount (%).
AIM:
To write a python program to find sale price of an item with given cost and discount
(%).
METHOD:
Python
PROGRAM:
cost_price=float(input("Enter the price of item:"))
discount=float(input("Enter the discount %:"))
selling_price=float(((100-discount)/cost_price)*100)

print("The selling price of item is:",selling_price)

RESULT:
Thus the python program to find sale price of an item with given cost and
discount (%). was created and executed successfully.
OUTPUT:
3. Calculate perimeter/circumference and area of shapes such as triangle,
rectangle, square and circle

AIM:
To write a python program to calculate perimeter/circumference and area of shapes
such as triangle, rectangle, square and circle.
METHOD:
Python
PROGRAM:
import math
def area_square(a):
area1=float(a*a);
print("Area of square is:",area1)
def area_circle(r):
area2=float(3.14*r*r);
print("Area of circle is:",area2)
def area_rectangle(a,b):
area3=float(a*b);
print("Area of rectangle is:",area3)
def area_triangle(x,y):
area4=float((x*y)/2);
print("Area of triangle is:",area4)
def peri_square(a):
peri1=float(4*a);
print("Perimeter of square is:",peri1)
def peri_circle(r):
peri2=float(2*3.14*r);
print("Perimter of circle is:",peri2)
def peri_triangle(a,b):
hypotenuse=float(math.sqrt(a*a+b*b))
peri3=float(a+b+hypotenuse)
print("Perimter of right angled triangle is:",peri3)
def peri_rectangle(a,b):
peri4=float(2*(a+b))
print("Perimter of rectangle is:",peri4)

side=float(input("enter the side of square:"))


area_square(side)
print()
peri_square(side)
radius=float(input("enter the radius of circle:"))
area_circle(radius)
peri_circle(radius)
length=float(input("enter the length of rectangle:"))
breadth=float(input("enter the breadth of rectangle:"))
area_rectangle(length,breadth)
peri_rectangle(length,breadth)
base=float(input("enter the base of right angled triangle:"))
height=float(input("enter the height of right angled triangle:"))
area_triangle(base,height)
peri_triangle(base,height)

RESULT:
Thus the python program to calculate perimeter/circumference and area of
shapes such as triangle, rectangle, square and circle was created and executed
successfully.
OUTPUT:
4. Compute simple interest and compound interest.
AIM:
To write a python program to compute simple interest and compound interest.
METHOD:
Python
PROGRAM:
p = float(input("Enter principal: "))
r = float(input("Enter rate: "))
t = int(input("Enter time: "))
si = (p * r * t) / 100
ci = p * ((1 + (r / 100 ))** t) - p
print("Simple interest = ", si)
print("Compound interest = ", ci)

RESULT:
Thus the python program to compute simple interest and compound interest was
created and executed successfully.
OUTPUT:
Enter principal: 15217.75
Enter rate: 9.2
Enter time: 3
Simple interest = 4200.098999999999
Compound interest = 4598.357987312007
5. Calculate profit-loss for given Cost and Sell Price.
AIM:
To write a python program to calculate the profit or loss of an item based on the cost
price and selling price entered by the user.
METHOD:
Python
PROGRAM:
cost_price=float(input("Enter the cost Price of an Item :"))
selling_price=float(input("Enter the Selling Price of an Item :"))
if (selling_price > cost_price):
profit = selling_price - cost_price
print("Profit :",profit)
elif( cost_price > selling_price):
loss = cost_price - selling_price
print("Loss :",loss)
else:
print("No Profit No Loss")

RESULT:
Thus the python program to calculate the profit or loss of an item based on the
cost price and selling price was created and executed successfully.
OUTPUT:
Enter the cost Price of an Item :230
Enter the Selling Price of an Item :250
Profit : 20.0
6. Calculate EMI for Amount, Period and Interest.
AIM:
To write a python program to calculate EMI for Amount, Period and Interest.

METHOD:
Python
PROGRAM:
amount = float(input("Enter the base amount :- "))
period = float(input("Enter the time period :- "))
rate = float(input("Enter rate of Interest :- "))
interest = amount * period * rate /100
total = amount + interest
emi = total /(period * 12)
print("EMI amount is ",emi)

RESULT:
Thus the python program to calculate EMI for Amount, Period and Interest was
created and executed successfully.
OUTPUT:
Enter the base amount :- 1000
Enter the time period :- 2
Enter rate of Interest :- 0.5
EMI amount is 42.083333333333336
7. Calculate tax - GST / Income Tax
AIM:
To write a python program to calculate tax - GST / Income Tax

METHOD:
Python
PROGRAM:
cost = float(input("Enter cost of the product/service:- "))
gstper = float(input("Enter the % charged for gst :- "))
gst = cost * gstper/100
amount = cost + gst
print("GST is :- ",gst)
print("Amount to Pay is :- ",amount)

# Income Tax
income = float(input("Enter total annual income :- "))
if income <20000:
tax = 0
elif income <400000:
tax = (income-200000)*0.05
elif income <800000:
tax = (income-400000)*0.07 + 10000
else :
tax = (income-800000)*0.1 +38000
print("Income Tax to pay",tax)

RESULT:
Thus the python program to calculate tax - GST / Income Tax was created and
executed successfully.
OUTPUT:
Enter cost of the product/service:- 500
Enter the % charged for gst :- 12
GST is :- 60.0
Amount to Pay is :- 560.0
Enter total annual income :- 80000
Income Tax to pay -6000.0
8. Find the largest and smallest numbers in a list
AIM:
To write a python program to find the largest and smallest numbers in a list.

METHOD:
Python
PROGRAM:
lst = []
num = int(input('How many numbers: '))
for n in range(num):
numbers = int(input('Enter number '))
lst.append(numbers)
print("Maximum element in the list is :", max(lst), "\nMinimum
element in the list is :", min(lst))

RESULT:
Thus the python program to find the largest and smallest numbers in a list was
created and executed successfully.
OUTPUT:
How many numbers: 5
Enter number 12
Enter number 45
Enter number 56
Enter number 67
Enter number 78
Maximum element in the list is : 78
Minimum element in the list is : 12
9. Print the first ‘n’ multiples of given number
AIM:
To write a python program to print the first ‘n’ multiples of given number.

METHOD:
Python
PROGRAM:
while True:

a = input('enter value:')
b = input('enter how many multiple:')
b=int(b)
a=int(a)
print('find multiples of', a)
print('this many times:', b)
for i in range (1, b+1):
i=int(i)
print ('{0} x {1} = {2}'.format(a, i, a*i))
print('Do you want to exit:')
c=input('yes or no:')
if c =='yes':
break

RESULT:
Thus the python program to print the first ‘n’ multiples of given number was
created and executed successfully.
OUTPUT:
enter value:12
enter how many multiple:3
find multiples of 12
this many times: 3
12 x 1 = 12
12 x 2 = 24
12 x 3 = 36
Do you want to exit:
yes or no:y
10. Count the number of vowels in user entered string
AIM:
To write a python program to count the number of vowels in user entered string

METHOD:
Python
PROGRAM:
#take user input
String = input('Enter the string :')
count = 0
#to check for less conditions
#keep string in lowercase
String = String.lower()
for i in String:
if i == 'a' or i == 'e' or i == 'i' or i == 'o' or i == 'u':
#if True
count+=1
#check if any vowel found
if count == 0:
print('No vowels found')
else:
print('Total vowels are :' + str(count))

RESULT:
Thus the python program to count the number of vowels in user entered string
was created and executed successfully.
OUTPUT:
Enter the string :hello
Total vowels are :2
11.Print the words starting with an alphabet in a user entered string

AIM:
To write a python program to print the words starting with an alphabet in a user
entered string.
METHOD:
Python
PROGRAM:
s1=input("Enter any string:")
ch=input("Enter a character:")
print("The words starting with letter",ch,"are")
for a in s1.split():
if a[0]==ch:
print(a)

RESULT:
Thus the python program to print the words starting with an alphabet in a user
entered string was created and executed successfully.
OUTPUT:
Enter any string: Hello! How is your Health ?
Enter a character: H
The words starting with letter H are
Hello!
How
Health
12.Print number of occurrences of a given alphabet in each string.
AIM:
To write a python program to print number of occurrences of a given alphabet in
each string.
METHOD:
Python
PROGRAM:
s1=input("Enter a string:")
ch=input("Enter character to count its occurance in a given string:")
c=0
for a in s1:
if ch==a:
c=c+1
print(ch,"occurs",c,"times in",s1)

RESULT:
Thus the python program to print number of occurrences of a given alphabet in
each string was created and executed successfully.
OUTPUT:
Enter a string: The big brown bear bit the bug
Enter character to count its occurance in a given string:b
b occurs 5 times in The big brown bear bit the bug
13.Create a dictionary to store names of states and their capitals
AIM:
To write a python program to create a dictionary to store names of states and their
capitals
METHOD:
Python
PROGRAM:
states=dict()
n=int(input("How many states are there:"))
for i in range(n):
state=input("Enter name of the state:")
capital=input("Enter name of the capital:")
states[state]=capital
print("Created dictionary is:",states)
temp = input("Enter the state to display capital:")
print(states[temp])

RESULT:
Thus the python program to create a dictionary to store names of states and
their capitals was created and executed successfully.
OUTPUT:
How many states are there:5
Enter name of the state:Tamil Nadu
Enter name of the capital:Chennai
Enter name of the state:Karnataka
Enter name of the capital:Bangalore
Enter name of the state:Andhra Pradesh
Enter name of the capital:Amaravati
Enter name of the state:Kerala
Enter name of the capital:Trivandrum
Enter name of the state:Maharashtra
Enter name of the capital:Mumbai
Created dictionary is: {'Tamil Nadu': 'Chennai', 'Karnataka': 'Bangalore', 'Andhra
Pradesh': 'Amaravati', 'Kerala': 'Trivandrum', 'Maharashtra': 'Mumbai'}
Enter the state to display capital:Tamil Nadu
Chennai
14.Create a dictionary of students to store names and marks obtained in 5 subjects

AIM:
To write a python program to create a dictionary of students to store names and
marks obtained in 5 subjects.
METHOD:
Python
PROGRAM:
students=dict()
n=int(input("How many students are there:"))
for i in range(n):
sname=input("Enter name of the student:")
marks=[]
for j in range(5):
mark=float(input("Enter Marks:"))
marks.append(mark)
students[sname]=marks
print("Created Dictionary of students is",students)
name=input("Enter name of the student:")

if name in students.keys():
print(students[name])
else:
print("No student found with this name")

RESULT:
Thus the python program to create a dictionary of students to store names and
marks obtained in 5 subjects was created and executed successfully.
OUTPUT:
How many students are there:3
Enter name of the student:Arushi
Enter Marks:78
Enter Marks:65
Enter Marks:76
Enter Marks:80
Enter Marks:70
Enter name of the student:Priya
Enter Marks:34
Enter Marks:32
Enter Marks:45
Enter Marks:46
Enter Marks:56
Enter name of the student:Daniel
Enter Marks:67
Enter Marks:56
Enter Marks:68
Enter Marks:78
Enter Marks:89
Created Dictionary of students is {'Arushi': [78.0, 65.0, 76.0, 80.0, 70.0], 'Priya':
[34.0, 32.0, 45.0, 46.0, 56.0], 'Daniel': [67.0, 56.0, 68.0, 78.0, 89.0]}
Enter name of the student:Daniel
[67.0, 56.0, 68.0, 78.0, 89.0]
15.Print the highest and lowest values in the dictionary.
AIM:
To write a python program to print the highest and lowest values in the dictionary.
METHOD:
Python
PROGRAM:
students={"Anita" : 89,"Parul":67,"Payal":96,"Rahul":79}
highest=max(students,key = students.get)
hmarks=max(students.values())
print("Student with highest marks is",highest,"scoring",hmarks)
lowest=min(students,key = students.get)
mmarks=min(students.values())
print("Students with lowest marksi s",lowest,"scoring",mmarks)

RESULT:
Thus the python program to print the highest and lowest values in the
dictionary was created and executed successfully.
OUTPUT:
Student with highest marks is Payal scoring 96
Students with lowest marks is Parul scoring 67
16. To find the third largest/smallest number in a list.
AIM:
To write a python program to find the third largest/smallest number in a list.
METHOD:
Python
PROGRAM:
numbers=[]
for i in range(10):
num=int(input("Enter a number:"))
numbers.append(num)
print("Given list is",numbers)
max1=max(numbers)
numbers.remove(max1)
max2=max(numbers)
numbers.remove(max2)
max3=max(numbers)
print("Third highest number is",max3)
min1=min(numbers)
numbers.remove(min1)
min2=min(numbers)
numbers.remove(min2)
min3=min(numbers)
print("Third lowest number is",min3)

RESULT:
Thus the python program to find the third largest/smallest number in a list was
created and executed successfully.
OUTPUT:
Enter a number:34
Enter a number:45
Enter a number:76
Enter a number:1
Enter a number:9
Enter a number:2
Enter a number:34
Enter a number:23
Enter a number:66
Enter a number:88
Given list is [34, 45, 76, 1, 9, 2, 34, 23, 66, 88]
Third highest number is 66
Third lowest number is 9
17. Find the sum of squares of the first 100 natural numbers.

AIM:
To write a python program to find the sum of squares of the first 100 natural
numbers.
METHOD:
Python
PROGRAM:
total=0
for num in range(1,101):
sq=num**2
total+=sq
print("Sum of squares of natural numbers from 1 to 100 is",total)

RESULT:
Thus the python program to find the sum of squares of the first 100 natural
numbers was created and executed successfully.
OUTPUT:
Sum of squares of natural numbers from 1 to 100 is 338350
MY SQL QUERIES
18. Create a database

AIM:
To create a database 'School' on the database server, show the list of databases and
open it.
METHOD:
My SQL
QUERIES:
create database school;
show databases;
use school;

RESULT:
Thus the database 'School' was created on the database server, the list of
databases were shown, then opened and executed successfully.
OUTPUT:
19. Create a table and add primary key.

AIM:
To create a student1 table with the student id, class, section, gender, name, DOB and
marks as attributes where the student id is the primary key.

METHOD:
My SQL
QUERIES:
create table student1( sid integer primary key, Name varchar(10), class
char(3), section char(1), gender char(1), dob date, Marks int(3));
desc student1;

RESULT:
Thus the student table was created and primary key was added and executed
successfully.
OUTPUT:
20.Insert the details of at least 10 students in a table.
AIM:
To insert the details of at least 10 students in a table.

METHOD:
My SQL
QUERIES:
CREATE TABLE students (
Studentid INTEGER PRIMARY KEY,
Class VARCHAR(5) NOT NULL,
Section VARCHAR(20) NOT NULL,
Gender CHAR(1) NOT NULL,
Name VARCHAR(30) NOT NULL,
Dob date NOT NULL,
Marks DECIMAL
);
INSERT INTO students VALUES (1101,'XI','A','M','Aksh','2005/12/23',88.21);
INSERT INTO students VALUES (1102,'XI','B','F','Moksha','2005/03/24',77.90);
INSERT INTO students VALUES (1103,'XI','A','F','Archi','2006/04/21',76.20);
INSERT INTO students VALUES (1104,'XI','B','M','Bhavin','2005/09/15',68.23);
INSERT INTO students VALUES (1105,'XI','C','M','Kevin','2005/08/23',66.33);
INSERT INTO students VALUES (1106,'XI','C','F','Naadiya','2005/10/27',62.33);
INSERT INTO students VALUES (1107,'XI','D','M','Krish','2005/01/23',84.33);
INSERT INTO students VALUES (1108,'XI','D','M','Ayush','2005/04/23',55.33);
INSERT INTO students VALUES (1109,'XI','C','F','Shruti','2005/06/01',74.33);
INSERT INTO students VALUES (1110,'XI','D','F','Shivi','2005/10/19',72.30);

SELECT * FROM students;


RESULT:
Thus the student table was created and primary key was added and executed
successfully.
OUTPUT:
Studentid Class Section Gender Name Dob Marks
1101 XI A M Aksh 2005-12-23 88
1102 XI B F Moksha 2005-03-24 78
1103 XI A F Archi 2006-04-21 76
1104 XI B M Bhavin 2005-09-15 68
1105 XI C M Kevin 2005-08-23 66
1106 XI C F Naadiya 2005-10-27 62
1107 XI D M Krish 2005-01-23 84
1108 XI D M Ayush 2005-04-23 55
1109 XI C F Shruti 2005-06-01 74
1110 XI D F Shivi 2005-10-19 72

[Execution complete with exit code 0]


21. Increase marks by 5% for those students who have Marks more
than 450.
AIM:
To increase marks by 5% for those students who have Marks more than
450.

METHOD:
My SQL
QUERIES:
Update student1 set marks=marks+marks*5/100 where marks>450;

RESULT:
Thus the MySQL queries to increase marks by 5% for those students who have
scored more than 450 were executed successfully.
OUTPUT:
22.Display the entire content of the table.
AIM:
To display the entire content of the table.
METHOD:
My SQL
QUERIES:
select * from student1;

RESULT:
Thus the MySQL query to display the entire content of the table was executed
successfully.
OUTPUT:
23. Add a new column with appropriate data type.
AIM:
To add a new column email in the student1 table with appropriate data type.
METHOD:
My SQL
QUERIES:
Alter table Student1 add email varchar(40);
describe studetn1;

RESULT:
Thus the MySQL query to add a new column email in the student1table with
appropriate data type was executed successfully.
OUTPUT:
24. Add data to the new column with appropriate data type.
AIM:
To add the email ids of each student in the previously created email column.

METHOD:
My SQL
QUERIES:
Update student1 set email=’[email protected]’ where sid=101;
Select * from student1;

RESULT:
Thus the MySQL query to add a new column email in the student1table with
appropriate data type was executed successfully.
OUTPUT:
25. Display Sid, Name, DOB of those students who are born between
‘1995-01-01’ and‘1995-12-31’
AIM:

To display Sid, Name, DOB of those students who are born between ‘1995-
01-01’ and‘1995-12-31’

METHOD:
My SQL
QUERIES:
Select Sid, Name, DOB from Student1 where DOB between ‘1995-01-01’ and
‘1995- 12-31’;

RESULT:
Thus the MySQL query to display Sid, Name, DOB of those students who are
born between ‘1995-01-01’ and‘1995-12-31’was executed successfully.
OUTPUT:

n-gl.com

You might also like