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

Practical file (complete)

Uploaded by

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

Practical file (complete)

Uploaded by

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

A.K.

CHILDREN ACADEMY,
RAJ NAGAR Extension, GZB

Practical file on
Computer science (083)
Session: 2023-2024

Topics covered: Python Programs

SUBMITTED TO: SUBMITTED BY:

Ms. Achla Agarwal Ummi Parthasarathi


PGT(COMP.SCI) Class: XI-A
Roll No.: 25
13. WAP that reads a line & prints the following :
(Use string functions)
1. Original String :
2. Reverse String :
3. Length of the String:
4. Count the number of characters in the string.
5. Count the number of words in the string.
6. Count the number of spaces in the string.
7. Count the number of alphabets in the string.
8. Count the number of digits in the string.
9. Count the number of uppercase letters.
10. Count the number of lowercase letters
14. WAP that prompts the user for a string s & a character c, &
outputs the string produced from s by capitalizing each
occurrences of the character c in s & making all others
characters lowercase. For example, if the user inputs
“Mississippi” and “s” , the program outputs “miSSiSSippi”

15. WAP to input a list of numbers and find the smallest


and largest number from the list.
16. WAP to print alternate characters in a string. Input a
string of your own choice.
17. WAP to display prime numbers up to a certain limit.
18. Create a list that contains the names of 5 students
of your class. (Do not ask for input to do so)
(i) Print the list
(ii) Ask the user to input one name and append it to
the list
(iii) Print the list
(iv) Ask user to input a number. Print the name that
has the number as index (Generate error message
if the number provided is more than last index
value).
(v) Add “Kamal” and “Sanjana” at the beginning of
the list by using “+”.
(vi) Print the list
(vii) Ask the user to type a name. Check whether
that name is in the list. If exist, delete the name,
otherwise append it at the end of the list.
(viii) Create a copy of the list in reverse order
(ix) Print the original list and the reversed list.
(x) Remove the last element of the list.
19. Write a program that contains user-defined
functions to calculate area, perimeter or surface
area, whichever is applicable, for various shapes
like square, rectangle, triangle, circle and cylinder.
The user-defined functions should accept values for
calculation as parameters and the calculated value
should be returned. Import the module and use
appropriate functions.
20. Write a code to create customer’s list with their
number & name and delete any particular customer
using his /her number.(using dictionaries)
21. Write a Python program to input ‘n’ names and
phone numbers to store it in a dictionary and print
the phone number of a particular name.
(using dictionaries)
22. Write a program to input ‘n’ customers’ name and
store it in tuple and display all customers’ names on
the output screen.
23. Write a Python program to generate a random
number between 0 to 9.
24. WAP to check whether the given string is a
palindrome or not.
25. Write a function called remove_duplicates that
takes a list and returns a new list with only the
unique elements from the original. Hint: they don't
have to be in the same order
26. WAP to enter the string. Extract all the digits from the string ,
if there are digits then sum the collected digits together &
display Original string, the digits, the sum of the digits. If
there are no digits then print “has no digits”.

27. Write a program to input ‘n’ employees’ salary and


find minimum & maximum salary among ‘n’
employees. (using tuples)
28. Write a program to input ‘n’ numbers and separate
the tuple in the following manner.
Example:
T=(10,20,30,40,50,60)
T1 =(10,30,50)
T2=(20,40,60)
WAP that reads a line & prints the following :

(Use string functions)


1. Original String

2. Reverse String

3. Length of the String

4. Count the number of characters in the string

5. Count the number of words in the string

6. Count the number of spaces in the string

7. Count the number of alphabets in the string

8. Count the number of digits in the string

9. Count the number of uppercase letters

10. Count the number of lowercase letters

Input:
Output:
WAP that prompts the user for a string s & a character c,
& outputs the string produced from s by capitalizing each
occurrences of the character c in s & making all others
characters lowercase. For example, if the user inputs
“Mississippi” and “s” , the program outputs “miSSiSSippi”

Input:

Output:
WAP to input a list of numbers and find the
smallest and largest number from the list.

Input:

Output:
WAP to display prime numbers up to a certain limit.

Input:

Output:
WAP to display prime numbers up to a certain limit.

Input:

Output:
Create a list that contains the names of 5 students of your
class. (Do not ask for input to do so)
(i) Print the list

(ii) Ask the user to input one name and append it to the list

(iii) Print the list

(iv) Ask user to input a number. Print the name that has the number
as index (Generate error message if the number provided is more
than last index value).

(v) Add “Kamal” and “Sanjana” at the beginning of the list by using
“+”.

(vi) Print the list

(vii) Ask the user to type a name. Check whether that name is in the
list. If exist, delete the name, otherwise append it at the end of the
list.

(viii) Create a copy of the list in reverse order

(ix) Print the original list and the reversed list.

(x) Remove the last element of the list.

Input:
Output:
Write a program that contains user-defined functions to
calculate area, perimeter or surface area, whichever is
applicable, for various shapes like square, rectangle,
triangle, circle and cylinder. The user-defined functions
should accept values for calculation as parameters and
the calculated value should be returned. Import the
module and use appropriate functions.

Input:
Main program (contains functions for the above tasks):
Test program:
Output:
Write a code to create customer’s list with their number &
name and delete any particular customer using

his /her number.( using dictionaries)

Input:

Output:
Write a Python program to input ‘n’ names and
phone numbers to store it in a dictionary and print
the phone number of a particular name.

(using dictionaries)

Input:

Output:
Write a program to input ‘n’ customers’ name and
store it in tuple and display all customers’ names
on the output screen.

Input:

Output:
Write a Python program to generate a random
number between 0 to 9.

Input:

Output:
WAP to check whether the given string is a
palindrome or not.

Input:

Output:
Write a function called remove_duplicates that
takes a list and returns a new list with only the
unique elements from the original. Hint: they don't
have to be in the same order

Input:

Output:
WAP to enter the string. Extract all the digits from the
string , if there are digits then sum the collected digits
together & display Original string, the digits, the sum of
the digits. If there are no digits then print “has no digits”.

Input:

Output:
Write a program to input ‘n’ employees’ salary and
find minimum & maximum salary among ‘n’
employees. (using tuples)

Input:

Output:
Write a program to input ‘n’ numbers and separate the
tuple in the following manner.

Example:

T=(10,20,30,40,50,60)

T1 =(10,30,50)

T2=(20,40,60)

Input:

Output:

You might also like