Programming and problem solving through python Practical Questions
Topic : Introduction to Python
Question - 1
Python program to input a welcome message and print it
Question - 2
Python program to print number of seconds in year
Question - 3
Python program to calculate GST Goods and Service Tax
Question - 4
Python program to find the ASCII Value of entered character
Question - 5
Python program that display a joke but display the punch
line only when the user presses enter key
Question - 6
Python program to generate the following output 5 10 9
Question - 7
Python program to print 5@10@9
Topic: Operators Expressions and Python Statements
Question - 1
Python program to find a side of a right-angled triangle
whose two sides and an angle is given
Question - 2
Python program to obtain the marks in computer of some
student and find mean median and mode
Question - 3
Write a Python code to calculate and display the value of
Sine 45° and Cosine 30°
Question - 4
Python program to accept the Base and Perpendicular and find
the Hypotenuse
Question - 5
Python program to accept three side of triangle and find its area by using Herons Formula
Question - 6
Python program to accept side of Equilateral Triangle and
find its area
Question - 7
Python program to check whether dart hit inside board or
outside
Question - 8
Python Program to obtain temperature in Celsius and convert
it into Fahrenheit
Question - 9
Python program to print the area of circle when radius of
the circle is given by user
Question - 10
Python program to print the volume of a cylinder when radius and height of the cylinder is given by user.
Question - 11
Python program that asks your height in centimeters and
converts it into foot and inches
Question - 12
Python program accept three side of triangle and find area
of a triangle
Question - 13
Python program to input principle amount,rate time and
calculate simple interes
Question - 14
Python program which take value of x y z from the user and calculate the equation
Question - 15
Python program to take the temperatures of all 7 days of the
week and displays the average temperature of that week
Question - 16
Python program to read a number in n and prints n2 n3 n4
Question - 17
Python program to obtain three numbers and print their sum
Question - 18
Python program to obtain length and breath of a rectangle and calculate its area
Question - 19
Python program to calculate body mass index of a person
Question - 20
Python program to input a number and print its cube
Question - 21
Python program to input a single digit and print a 3 digit
number
Question - 22
Python program to calculate the compound interest
Question - 23
Python program to find sale price of an item with given price and discount
Question - 24
Python program for addition of two times in hour and minute
format
Question - 25
Python program for addition of two times in hour minute and
second format
Question - 26
Python Program to Calculate the Area of a Triangle
Question - 27
Python program to print quotient
Question - 28
Python program to calculate simple interest
Question - 29
Python program to calculate area and perimeter of a
parallelogram
Question - 30
Python program demonstrating working with power operator
Question - 31
Python program of division operator
Question - 32
Python program of modulus
Question - 33
Python program convert dollars in Rupee
Question - 34
Python program to convert kilometers to miles
Question - 35
Python program to convert the distance in feet to inches
yards and miles
Question - 36
Python program to display menu to calculate area of square
or rectangle
Question - 37
Python program to obtain x y z from user and calculate
expression
Question - 38
Python program that reads a number of seconds and prints it in form mins and seconds
Question - 39
Python program that asks a user for a number of years and
then prints out the number of days hours minutes and seconds
Question - 40
Python program to take a 2 digit number and then print the
reversed number
Question - 41
Python program to take a 3 digit number and then print the
reversed number
Question - 42
Python program to take two inputs for day month and then
calculate which day of the year
Question - 43
Python program that inputs an age and print age after 10
years
Question - 44
Python program to calculate the radius of a sphere whose
area is given
Question - 45
Python program to calculate the area of an equilateral
triangle
Question - 46
Python program to input the radius of a sphere and calculate
its volume
Question - 47
Python program to calculate amount payable after simple
interest
Question - 48
Python program to input the time in second and convert into
hours minute and seconds
Question - 49
Python program to input 3 numbers and check all are same or
not
Question - 50
Python program to input 3 numbers from user and check these
are unique numbers are not
Question - 51
Python program to take year as input and check if it is a
leap year or not
Question - 52
Python program to take two numbers and print if the first
number is fully divisible by second number or not
Question - 53
Python program to input two number and swap them
Question - 54
Python program to input three number and swap 3 numbers
Question - 55
Python program to read 3 numbers in 3variables and swap
first two variables with the sums of first and second
Question - 56
Python credit card program
Question - 57
Python program to print absolute value of number provided by
the user
Question - 58
Python program to check divisibility of a number
Question - 59
Python program to print the largest number
Question - 60
Python program to check number is even or odd
Question - 61
Python program to print larger number using swap
Question - 62
Python program to input three unequal numbers and display
the greatest and the smallest number
Question - 63
Python program to take two numbers and check that the first
number is fully divisible by second number or not
Question - 64
Python program to check the given year is leap year or not
Question - 65
Python program to calculate the roots of a given quadratic
equation.
Question - 66
Python program to find simple interest based upon number of
years
Question - 67
Python program to check where is profit or loss
Question - 68
Python program to check number is buzz number or not
Question - 69
Python program to input assets liabilities and capital then
check accounting equation means balanced or not
Question - 70
Python program to input total debt and total assets and
calculate total debt to total assets ratio and check whether major funded by
assets or equity
Question - 71
Python program to calculate debt to equity check whether it
is risky scenario for investor or not
Question - 72
Python program to input 2 integer number and check where
they are same of different number
Question - 73
Pythoon program to read todays date only date Part from user
Then display how many days are left in the current month
Question - 74
Python program to compute the result when two numbers and
one operator is given by user
Question - 75
Python program to input a digit and print it in words
Question - 76
Python program to input any choice and to implement the
following
Question - 77
Python program to check number is positive negative or zero
Question - 78
Python program to calculate electricity bill
Question - 79
Python program to input three number and print in ascending
order
Question - 80
Python program to check character is alphabetic character or
not
Question - 81
Python program to input length of three sides of a triangle
Then check if these sides will form a triangle or not
Question - 82
Python program to input 3 sides of a triangle and print
whether it is an equilateral scalene or isosceles triangle
Question - 83
Python program using if Elif else statement to find the
number of days present in a month
Question - 84
Python program to accept marks of English math and science
and display the appropriate stream allotted to the candidate
Question - 85
Python program to calculate income tax based on condition
Question - 86
Python program to calculate volume of cuboid cylinder and
cone based on user choice
Question - 87
Python program to input any number and to find reverse of
that number
Question - 88
Python program to input any string and count number of
uppercase and lowercase letters
Question - 89
Python program to accept a integer number and find its sum
of digit
Question - 90
Python program to count the number of digits in given number
Question - 91
Python program to find the largest digit of a given number
Question - 92
Python program to find the smallest digit of a given number
Question - 93
Python program to find the difference between greatest and
smallest digits presents in the number
Question - 94
Python program to print the frequency of digits present in
given number
Question - 95
Python program to check whether given number is Armstrong or
not
Question - 96
Python program to convert decimal number to binary
Question - 97
Python program to convert binary to decimal
Question - 98
Python program to input list of numbers and find those which
are palindromes
Question - 99
Python program to place and the most significant digit of
number
Question - 100
Python program to find the LCM of two input numbers
Question - 101
Python program to find GCD of 2 number
Question - 102
Python program to check number is special or not
Question - 103
Python program to find the smallest digit of the input
number
Question - 104
Python program to check whether it is a prime number or not
If it is not a prime then display the next number that is prime
Question - 105
Python program to calculate compound simple interest after
taking the principle rate and time
Question - 106
Python program that searches for prime numbers from 15
through 25
Question - 107
Python program to test if given number is prime or not
Question - 108
Python program to check whether square root of a given
number is prime or not
Question - 109
Python program to print first n odd numbers in descending
order.
Question - 110
Python program to find the average of the list of the
numbers entered through keyboard
Question - 111
Python program to find the largest number from the list of
the numbers entered through keyboard
Question - 112
Python program to find the sum of n natural numbers
Question - 113
Python program to find the sum of first n even numbers
Question - 114
Python program to find the sum of first n odd numbers.
Question - 115
Python program to generate a list of elements of Fibonacci
Series
Question - 116
Python program to input any number and to print all natural
numbers up to given number
Question - 117
Python program to input any number and to find sum of all
natural numbers up to given number
Question - 118
Python program to find the factorial value of given number
Question - 119
Python program to print factor of given number
Question - 120
Python program to check given number is composite number or
not
Question - 121
Python program to print table of entered number
Question - 122
Python program to calculate the sum of odd numbers divisible
by 5 from the range 1 to 100
Question - 123
Python program to print Floyds triangle
Question - 124
Python program to find all prime numbers up to given number
Question - 125
Python program to print letters of word
Question - 126
Python program to print ASCII code for entered message
Question - 127
Python program to print first ten mersenne numbers
Question - 128
Python program to Print numbers from 11 to N When the number
is a multiple of 3 print Tipsy when it is a multiple of 7 print Topsy
Question - 129
Python program to print every integer between 1 and n
divisible by m Also report whether the number that is divisible by m is even or
odd
Question - 130
Python program to input N numbers and then print the second
largest number
Question - 131
Python program to check number is perfect number or not
Question - 132
Python program to print all buzz numbers between 1 to n
Question - 133
Python program to display the first ten terms of the
following series 2 5 10 17
Question - 134
Python program to find the sum of first ten terms of the
series
Question - 135
Python program to print first n perfect numbers
Question - 136
Python program to print the sum of series
Question - 137
Python function which takes list of integers as input and
finds the followings
Question - 138 [ O Level JUL-2021]
Python program to print all the prime numbers in the given
range
Topic : Sequence data types in python
Question - 1
Python program to find the 2nd largest number from the list
of the numbers entered through keyboard.
Question - 2
Python program that creates a list of numbers from 1 to 20
that are divisible by 4
Question - 3
Python program to define a list of countries that are a
member of BRICS Check whether a county is member of BRICS or not
Question - 4
Python program to read marks of six subjects and to print
the marks scored in each subject and show the total marks
Question - 5
Python program to read prices of 5 items in a list and then
display sum of all the prices product of all the prices and find the average
Question - 6
Python program to count the number of employees earning more
than 1 lakh per annum
Question - 7
Python program to create a list of numbers in the range 1 to
10 Then delete all the even numbers from the list and print the final list
Question - 8
Python program to generate in the Fibonacci series and store
it in a list Then find the sum of all values
Question - 9
Python program to find minimum element from a list of
elements along with its index in the list
Question - 10
Python program to calculate mean of a given list of numbers
Question - 11
Python program to search for an element in a given list of
numbers
Question - 12
Python program to count frequency of a given element in a
list of numbers
Question - 13
Python program to calculate the sum of integers of the list
Question - 14
Python program to reverses an array of integers
Question - 15
Python program to creates a third list after adding two
lists
Question - 16
Python program that input a list, replace it twice and then
prints the sorted list in ascending and descending order
Question - 17
Python program to check if the maximum element of the list
lies in the first half of the list or in the second half
Question - 18
Python program to display the maximum elements from the two
list along with its index in its list
Question - 19
Python program to swap list elements with even and locations
Question - 20
Python program to rotate list elements with next elements
Question - 21
Python program to increment the elements of list
Question - 22
Python program to enter a list containing number between 1
and 12 then replace all the entries in the list that are greater than 10 with
10
Question - 23
Python program that reverse the list of integers in place
Question - 24
Python program to input two list and create third list which
contains all elements of the first elements followed by all elements of second
list
Question - 25
Python program to inter list of string and create a new list
that consist of those strings with their first characters removed
Question - 26
Python program to create a list using for loop which consist
of integers 0 through 49
Question - 27
Python program to create a list using for loop which consist
square of the integers 1 through 50
Question - 28
Python program to create a list using for loop which consist
a bb ccc dddd that ends with 26 copies of the letter z.
Question - 29
Python program that takes any two list L and M of the same
size and adds their elements together in another third list
Question - 30
Python program to rotates the elements of list so that fist
elements move to second and second to the third
Question - 31
Python program to move all duplicate element to the end of
list
Question - 32
Python program to display the maximum and minimum values
form specified range of indexes of a list
Question - 33
Python program to compare two equal sized list and print the
first index where they differ
Question - 34
Python program that receives a Fibonacci series term and
returns a number telling which term it is
Question - 35
Python Program to accept three distinct digits and print all
possible combinations from the digits
Question - 36
Python Program to find the successor and predecessor of the
largest element in list
Question - 37
Python program to swap two values using tuple assignment
Question - 38
Python program using a function that returns the area and
circumference of a circle whose radius is passed as an argument
Question - 39
Python program that has a list of positive and negative
numbers Create a new tuple that has only positive numbers from the list
Question - 40
Python program to find maximum and minimum values in tuple
Question - 41
Python program to interchange the values of two tuple
Question - 42
Python program to interchange the values of two tuple
Question - 43
Python program that create a tuple storing first 9 terms of
Fibonacci series
Question - 44
Python program that receives the index and return the
corresponding value
Question - 45
Python program to create a nested tuple to store roll number
name and marks of students
Question - 46
Python program that interactively creates a nested tuple to
store the marks in three subjects for five students
Question - 47
Python Program that generate a set of prime numbers and
another set of even numbers
Question - 48
Python program to store the product information in
dictionary
Question - 49
Python program to create a dictionary whose keys are month
names and values are their corresponding number of days
Question - 50
Python program to enter names of employees and their
salaries as input and store them in a dictionary
Question - 51
Python program to count the number of times a character
appears in a given string
Question - 52
Python program to convert a number entered by the user into
its corresponding number in words
Question - 53
Python program Repeatedly ask the user to enter a team name
Question - 54
Python program that repeatedly asks the user to enter
product names and prices
Question - 55
Python Program to Create a dictionary whose keys are month
name and whose values are number of days in the corresponding month
Question - 56
Python program to store the detail of 10 students in a
dictionary at the same time
Question - 57
Python program to Create a dictionary with the opposite
mapping
Question - 58
Python program that lists the over lapping keys of the two
dictionaries if a key of d1 is also a key of d2 the list it
Question - 59
Python program that checks if two same values in a
dictionary have different keys
Question - 60
Python program to check if a dictionary is contained in
another dictionary
Question - 61
Python program to create a new dictionary D2 having same
keys as D1 but values as the sum of the list elements
Question - 62
Python program to create a dictionary has three keys assets
liabilities and capital
Question - 63 [ O Level JAN-2022]
Python function that takes a string as parameter and returns
a string with every successive repetitive character replaced
Topic : Functions in Python
Question - 1 [ O Level JUL-2023]
Write a function with name dividebyfive which generate and
prints a random integer number from the range 0 to 100 and then return True if
the randomly generated number is divisible by 5, and False otherwise.
Question - 2
Python program to create a function to calculate factorial
value
Question - 3
Python program to find the sum of factorial upto n terms
using function
Question - 4
Python program to create a function for reverse the number
Question - 5
Python program to check number is Palindrome or not using
function
Question - 6
Python program to create a function for calculating sum of
digit
Question - 7
Python function to find the sum of all numbers between 100
and 500 which are divisible by 2
Question - 8
Python function to get two matrices and multiply them
Question - 9
Python program to illustrate the global variable
Question - 10
Python program to convert decimal into other number systems
Question - 11
Python program that generates six random numbers in a
sequence created with start stop step
Question - 12
Python program to create recursive function to find
factorial
Question - 13
Python recursive function to find the sum of digits
Question - 14
Python recursive function to print the reverse of number
Question - 15
Python function to accept 2 number and return addition
subtraction multiplication and division
Question - 16
Python function to accept number of days and return week and
days to its equivalent
Question - 17
Python function to extract the day month year from given
date
Topic : File Processing in Python
Question - 1
Python program to read the full content of specified txt
file
Question - 2
Python program to accept file name and data from user and
write data on file
Question - 3
Python program to count the number of lines in the file
Question - 4
Python program to display the size of a file in byte
Question - 5
Python program to display only last line of a text file
Question - 6
Python program to display all the records in a file along
with line number
Question - 7
Python program that reads a text file and creates another
file that is identical except that every sequence of consecutive blank spaces
is replaced by single space
Question - 8
Python code to display digits from abc.txt file
Question - 9
Write Python code to display sentence starting with given
character from abc.txt file
Question - 10
Python program to copy the one contents to another
Question - 11
Python program to copy the all word which start with
constant in another file
Question - 12
Python program to read txt file data from specified index to
specified length
Question - 13
Python program to delete the specified file from computer
Question - 14
Python program to write first n prime number in text file
Question - 15
Python program to marge the content of target file into
source file
Question - 16
Python program to create a function that would read contents
from the sports.dat and creates a file named Atheletic.dat
Question - 17
Python program to add delete and display all record of
binary file
Question - 18
Python program to read csv file content line by line
Question - 19
Python program to read data from csv file
Question - 20
Python program to write data on csv file
Topic : Modules in Python
Question - 1
Python program to print the calendar of given month and year
Question - 2
Python program to print the calendar of given year
Question - 3
Python program to generate 6 digit random secure OTP between
100000 to 999999
Question - 4
Python program to generate 3 random integers between 100 and
999 which is divisible by 5
Question - 5
Python program to generate 6 random numbers and then print
their mean median and mode
Topic : NumPy Basics
Question - 1 [ O Level JAN-2023]
Create a numpy array having two dimensions and shape(3,3)
and perform the following operations on array elements:
Question - 2 [ O Level JAN-2023]
Write a program to find the intersection of two arrays
Topic : String Handling in Python
Question - 1
Python program input string and prints its characters in
different lines two characters per line
Question - 2
Python to print the number of occurrences of a sub string
into a line
Question - 3
Python program to check the given string is palindrome or
not
Question - 4
Python program that inputs a string and then prints it equal
to number of times its length
Question - 5
Python program to form a word by joining first character of
each word
Question - 6
Python program to reverse order of its words in given
sentence
Question - 7
Python program to find the longest word present in the
sentence along with its length
Question - 8
Python program to find the frequency of vowels in each word
Question - 9
Python program to input a word and display the pattern as
shown below