Practical file (complete)
Practical file (complete)
CHILDREN ACADEMY,
RAJ NAGAR Extension, GZB
Practical file on
Computer science (083)
Session: 2023-2024
2. Reverse String
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
(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
“+”.
(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.
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
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: