0% found this document useful (0 votes)
29 views

Computer Science Practical File: Guru Harkrishan Public School Vasant Vihar, New Delhi-57

The document contains a practical file for a Computer Science student named Prabhjot Singh. It lists 15 programming problems to solve including writing programs to calculate sphere area and volume, check for palindrome and prime numbers, display patterns, analyze string statistics, search strings, manipulate lists and tuples, create and search dictionaries. For each problem, space is allotted below to show the code and output.

Uploaded by

param9210340
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Computer Science Practical File: Guru Harkrishan Public School Vasant Vihar, New Delhi-57

The document contains a practical file for a Computer Science student named Prabhjot Singh. It lists 15 programming problems to solve including writing programs to calculate sphere area and volume, check for palindrome and prime numbers, display patterns, analyze string statistics, search strings, manipulate lists and tuples, create and search dictionaries. For each problem, space is allotted below to show the code and output.

Uploaded by

param9210340
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

GURU HARKRISHAN PUBLIC SCHOOL

VASANT VIHAR,NEW DELHI-57

Computer Science

Practical File

Name : Prabhjot Singh


Standard : XI
Section : B
Admission number : 17942
Roll number : 24
Session : 2023-24
S. No. List of Programs Page Sign.
Write a program to accept the radius of a
1. sphere from the user and display its area and
volume. Area=πr2 and volume=4πr3

Write a program to accept a number from the


2. user and display its factorial.

Write a program to accept a number from the


3. user and display whether it is a palindrome
number or not.

Write a program to accept a number from the


4. user and display whether it is a prime
number or not.

Write a program to display the following


5. pattern :
1
12
123
1234
12345
Write a program to display the following
6. pattern :
1
23
456
7 8 9 10
11 12 13 14 15
Write a program that reads a string and print
7. its statistics like : Number of Uppercase
letters, Number of lowercase letters, Number
of alphabets, Number of digits, Number of
symbols.
Write a program that asks the user for a
8. string s and character c and then it prints the
location of the character c in the string s.

Write a program that asks the user for a


9. string s and character c and then it prints the
location of the character c in the string s.

Extract two list slices out of the given list of


10. numbers. Display and print the sum of
elements of list slice which contains every
other element of the list between indexes 5 to
15. Program should display the average of
elements in second list slice that contains
every fourth element of the given list. The list
contains numbers 1 to 20.
Write a program to input two lists and
11. display the maximum element from the
elements of both the list combined, along
with the index in its list.
Write a program to input names of n students
12. and store them in a tuple. Also input a name
from the user and find if this student is
present in the tuple or not.
Write a program to check if a tuple contains
13. any duplicate elements.

Write a program to create a dictionary with


14. the roll number, name and marks of n
students in a class and displays the names of
students who have marks above 75.
Write a program that repeatedly asks the
15. user to enter product and prices. Store them
in a form of dictionary. Also write a code to
search item from the dictionary.
Program-1 : Write a program to accept the radius of a sphere
from the user and display its area and volume. Area=πr2 and
Volume=4πr3

Output:
Program-2: Write a program to accept a number from the user
and display its factorial.

Output:
Program-3: Write a program to accept a number from the user
and display whether it is a palindrome number or not.

Output:
Program-4 : Write a program to accept a number from the user
and display whether it is a prime number or not.

Output:
Program-5: Write a program to display the following pattern :

12

123

1234

12345

Output:

Output:
Program – 6 Write a program to display the following pattern :

23

456

7 8 9 10

11 12 13 14 15

Output:

Output:
Program 7: Write a program that reads a string and print its
statistics like : Number of Uppercase letters, Number of
lowercase letters, Number of alphabets, Number of digits,
Number of symbols.

Output:

Output:
Program-8 : Write a program that asks the user for a string and
character and then it prints the location of the character in the
string.

Output:
Program-9: Write a program to input a list and an element, and
remove all occurrences of the given element from the list.

Output:
Program – 10 : Extract two list slices out of the given list of
numbers. Display and print the sum of elements of list slice
which contains every other element of the list between indexes 5
to 15. Program should display the average of elements in second
list slice that contains every fourth element of the given list. The
list contains numbers 1 to 20.

Output:
Program-11 : Write a program to input two lists and display the
maximum element from the elements of both the list combined,
along with the index in its list.

Output:
Program-12 : Write a program to input names of n students and
store them in a tuple. Also input a name from the user and find if
this student is present in the tuple or not.

Output:
Program-13 : Write a program to check if a tuple contains any
duplicate elements.

Output:
Program-14 : Write a program to create a dictionary with the roll
number, name and marks of n students in a class and displays
the names of students who have marks above 75.

Output:
Program-15 : Write a program that repeatedly asks the user to
enter product and prices. Store them in a form of dictionary. Also
write a code to search item from the dictionary.

Output:

You might also like