SHRIRAM GLOBAL SCHOOL, WHITEFIELD, BLR-67
COMPUTER SCIENCE PRACTICAL PROGRAMS – PYTHON
SL.NO PROGRAM
1 Menu-driven program to perform all the arithmetic operations in python based on
users’ choice by creating separate user defined functions. Inputs can be accepted from
the user as two numbers.
2 Menu-driven program to find the area of different shapes such as Rectangle, Circle
and Triangle based on users’ choice by creating separate user defined functions.
3 Menu-driven program to input a number n, then perform the following operations
based on users’ choice by creating separate user defined functions.
a) Print Fibonacci series up to n terms
b) Print the factorial of n
c) Check whether n is a prime number or not.
d) Exit
4 Program to prompt the user to input a string(sentence). Write a menu-driven program
to create separate user defined functions to print the statistics related to the inputted
string.
a) Print total number of characters (including spaces and punctuations)
b) Print total number of words
c) Check whether any alphabet is present, and if present then print the total number of
upper-case and lower-case letters. Otherwise print appropriate message.
d) Total number of digits.
e) Exit
5 Program to create a numeric list and pass it as an argument to function and perform
the following operations on the list based on users’ choice.
a) double the odd values and make half of the even values in the list and display it
after changing.
b) display the mode value of the list
c) search for an element in the list and print its location, if found. Otherwise print
appropriate message.
d) Exit
6 Program to input s string (sentence), then write a menu-driven program to create
separate dictionaries for the following operations related to the string.
a) to print the dictionary contains frequency of each letter in the string.
b) to print the dictionary contains frequency of each digit in the string
c) to print the dictionary contains frequency of each special symbol in the string.
d) Exit
7 Program to create a package/module of arithmetic operations (+, -, *, /)
8 Menu-driven programs to create the following user-defined functions:
a) Generate_Random (): To pass two numbers and generate any 5 random numbers
from that range and insert it into a list, then print the list.
b) Random_Even_Sum (): To generate any random number between 1 – 50. If the
random number is even, then insert it to a separate list and print the sum of all
numbers in that list.