Professional Documents
Culture Documents
Python Lab Manual II Ece
Python Lab Manual II Ece
Description :
Python that searches an element in a list. Here both element and list must be
entered by user at run-time.
Search an element in a list of n elements
Check if a value exists in a given list, using in operator
Step 1: Enter the size of the list
Step 2: After entering the size of the list it will goes to
Step 3: Enter n elements for the list
Step 4: now enter ‘n’ elements
Step 5: Now u can enter the search element
Step 6: search element found at position
Program:
mylist = list()
for i in range(tot):
if elem == mylist[i]:
print("\n Element found at Position:", i+1)
else:
print("\n Element not in the list.")
EXPECTED OUTPUT:
OUTPUT:
Aim : To read radius and height of a cone and write a program to find the
volume of a cone
Description :
If we know the radius and Slant of a Cone then we calculate the Surface Area of
Cone using the below formula:
Surface Area = Area of the Cone + Area of Circle
Surface Area = πrl + πr²
Where r = radius and
l = Slant (Length of an edge from top of the cone to edge of a cone)
The amount of space inside the Cone is called as Volume. If we know the radius
and height of the Cone then we can calculate the Volume using the formula:
Volume = 1/3 πr²h (where h= height of a Cone)
Program:
import math
Expected output :
Output :