Practical File Class 11
Practical File Class 11
SCHOOL
RANIPUR,
HARIDWAR
PRACTICAL FILE
COMPUTER SCIENCE
SESSION: 2023-24
INDEX
S.No Program Name Page
No.
1. Program to print the table of a given number. 1
2. Write a program that accepts three numbers from user and display the 2
largest number
5. Write a program to print the sum of digits of a number given by the user. 5
9. Write a program to print the following star pyramid pattern using 9-12
concept of nested loop.
1 1 5
a) 1 2 b) c) d) 1 2 3 4 5
22 4 4 1234
123 333 3 3 3 123
1234 4444 2 2 2 2 12
12345 55555 1 1 1 1 1
1
10. Write a program to print the following pattern using concept of 13-15
nested loop.
* * * * **
** ****
*** ***
**** **
a) * * * * b) * c)
11. Write a program to print the following Alphabetical pattern using 16-17
concept of nested loop.
a) b)
A A
AB BB
ABC CCC
ABCD DDDD
ABCDE EEEEE
12. Find the sum of the following series using concept of nested loop upto n th
18
entered by the user.
1+x+x +x +x +. .......... x
2 3 4 n
13. Write a program to accept a character from the user and display whether 19
it is a vowel or consonant.
14. Write a program to print the sum of First n natural numbers, accept the 20
value of n from user.
16. Write a program to accept the marks for five subjects and calculate the 22
total marks & percentage and etc…
17. WAP to find the largest and smallest elements in the list of integers 23
entered by the user without using sort() function.
18. Input a list of numbers and swap elements at the even location with the 24
elements at the odd location.
19. WAP that returns the largest even number in the list of integers. If there 25
is no even number in input, print “No even number”.
20. WAP that prints the sum of the even indexed elements of L, minus the 26
sum of the odd-indexed elements of L.
21. WAP to print the alternate elements of a tuple T. 27
23. Write a python program that inputs two tuples and creates a third that 29
contains all elements of the first followed by all elements of the second.
24. Create a dictionary with the roll number, name and marks of n students 30
in a class and display the names of students who have scored marks
above 75.
25. Create a nested dictionary that stores the marks details along with 31
student names and then prints the output.
PROGRAM 1:
OUTPUT:
PROGRAM 2:
OUTPUT:
PROGRAM 3:
OUTPUT:
PROGRAM 4:
OUTPUT:
PROGRAM 5:
OUTPUT:
PROGRAM 6:
OUTPUT:
PROGRAM 7:
OUTPUT:
PROGRAM 8:
for i in range(1,6):
for j in range(1,i+1):
print(j,end="")
print()
OUTPUT:
PROGRAM 9 (b):
for i in range(1,6):
for j in range(1,i+1):
print(i,end="")
print()
OUTPUT:
PROGRAM 9 (c):
for i in range(5,0,-1):
for j in range(5,i-1,-1):
print(i,end="")
print()
OUTPUT:
PROGRAM 9 (d):
for i in range(5,0,-1):
for j in range(1,i+1):
print(j,end="")
print()
OUTPUT:
PROGRAM 10(a):
for i in range(1,6):
for j in range(1,i+1):
print("*",end="")
print()
OUTPUT:
PROGRAM 10(b):
for i in range(6,0,-1):
for j in range(1,i+1):
print("*",end="")
print()
OUTPUT:
PROGRAM 10(c):
rows = 5
k = 2 * rows - 2
for i in range(0, rows + 1):
for j in range(k, 0, -1):
print(end=" ")
k=k-1
for j in range(0, i):
print("*", end=" ")
print("")
OUTPUT:
PROGRAM 11(a):
for i in range(1,6):
p=65
for j in range(1,i+1):
print(chr(p),end="")
p=p+1
print()
OUTPUT:
PROGRAM 11(b):
OUTPUT:
PROGRAM 12:
s=0
n=int(input("Enter the value of n"))
x=int(input("Enter the value of x"))
for i in range(0,n+1):
s=s+(x**i)
print(s)
OUTPUT:
PROGRAM 13:
OUTPUT:
PROGRAM 14:
OUTPUT:
PROGRAM 15:
OUTPUT:
PROGRAM 16:
OUTPUT:
PROGRAM 17:
OUTPUT:
PROGRAM 18:
OUTPUT:
PROGRAM 19:
OUTPUT:
PROGRAM 20:
OUTPUT:
PROGRAM 21:
OUTPUT:
PROGRAM 22:
OUTPUT:
PROGRAM 23:
input1 = input("Enter elements for the first tuple separated by spaces: ")
tuple1 = tuple(input1.split())
input2 = input("Enter elements for the second tuple separated by spaces: ")
tuple2 = tuple(input2.split())
tuple3 = tuple1 + tuple2
print("The third tuple:", tuple3)
OUTPUT:
PROGRAM 24:
OUTPUT:
PROGRAM 25:
OUTPUT: