0% found this document useful (0 votes)
12 views7 pages

Class 11 Practical

The document contains 12 questions about Python programming concepts and examples of code to find the sum and mean of a list, remove duplicates from a list, find a value in a tuple, implement mathematical functions, generate random numbers, create a guessing game, check if a number is prime, use if/elif/else conditional logic, find the greatest of three numbers, calculate the factorial of a number, and create and display a dictionary of student data based on a marks threshold.

Uploaded by

krishgourav3
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)
12 views7 pages

Class 11 Practical

The document contains 12 questions about Python programming concepts and examples of code to find the sum and mean of a list, remove duplicates from a list, find a value in a tuple, implement mathematical functions, generate random numbers, create a guessing game, check if a number is prime, use if/elif/else conditional logic, find the greatest of three numbers, calculate the factorial of a number, and create and display a dictionary of student data based on a marks threshold.

Uploaded by

krishgourav3
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/ 7

CLASS 11 PRACTICAL FILE

Q1. Write a program in python to find the sum and mean of a list
lst=list(eval(input("enter the list")))
length=len(lst)
mean=sum=0
for i in range(0,length):
sum=sum+lst[i]
mean=sum/length
print("given list is:",lst)
print("the mean of the list is:",mean)

Q2. Python code to remove duplicate elements of a list.


# Python code to remove duplicate elements
def Remove(lst):
flist = []
for num in lst:
if num not in flist:
flist.append(num)
return flist

#Code
lst = [2, 4, 10, 20, 5, 2, 20, 4]
print(Remove(lst))
Q3. write a program to find the given value in a tuple.

T=(10,2, 34, 65,23,45,87,54)


print ("tuple:",T)
x = int(input("Enter value to search: "))
for a in T:
if a == x:
print("value found")
break
else:
print("Value not found")

Q4. Write a program in python to implement mathematical function


Q5. Write a random number generator that generates random numbers
between 1 and 6
(simulates a dice).

import random
def generate_random_number():
return random.randint(1, 6)
# usage:
random_number = generate_random_number()
print("Random number between 1 and 6:", random_number)

Q6. PROGRAM IN PYTHON TO CREATE GUESS THE NO. GAME


Q7.

Q8 . Write a program in python to find a number is prime or not .

Q9. WRITE A PROGRAM IN PYTHON TO ILLUSTRATE IF ELIF ELSE

print("Enter Marks Obtained in 5 Subjects: ")


total1 =int(input("Enter Marks Obtained in ENGLISH"))
total2 = int(input("Enter Marks Obtained in MATHS "))

total3 = int(input("Enter Marks Obtained in PHYSICS"))


total4 = int(input("Enter Marks Obtained in CHEMISTRY"))
total5 = int(input("Enter Marks Obtained in COMPUTER SCIENCE"))
tot = total1 + total2 + total3 + total4 + total5

avg = tot / 5
print("total marks=",tot)
print("percentage=",avg)
if avg >= 91 and avg <= 100:

print("Your Grade is A1")


elif avg >= 81 and avg < 91:
print("Your Grade is A2")
elif avg >= 71 and avg < 81:

print("Your Grade is B1")


elif avg >= 61 and avg < 71:
print("Your Grade is B2")
elif avg >= 51 and avg < 61:
print("Your Grade is C1")

elif avg >= 41 and avg < 51:


print("Your Grade is C2")
elif avg >= 33 and avg < 41:
print("Your Grade is D")

else:
print("Fail")
Q10. WRITE A PROGRAM IN PYTHON TO FIND THE GREATEST OF THREE

Q11. WRITE A PROGRAM IN PYTHON TO FIND THE FACTORIAL OF A GIVEN NO.


Q12 .Write a program to create a dictionarywith the roll number, name and marks
of n students in a class anddisplays the names of students who have marks above 75.

You might also like