Python Programming Questions with
Solutions
Q1) Write a Program to perform string manipulation operations using set
of pre-defined functions such as:
a) find()
b) upper()
c) len()
d) max() and min()
e) Fetching a specific content from the String
Solution:
OUTPUT
Q2) Write a Program to perform to test and check the mathematical
functions such as
a) ceil()
b) sqrt()
c) pow()
d) factorial()
Solution:
OUTPUT
Q3) Write a Program that receives a number as input from user and
returns if it is an odd or even number.
Solution:
OUTPUT
Q4) Write a Program that receives input from the user to calculate the
Area of Triangle.
Solution:
OUTPUT
Q5) Write a Program that receives input from the user to calculate the
Area of Square.
Solution:
OUTPUT
Q6) Write a Program that receives input from the user to calculate the
Area of Rectangle.
Solution:
OUTPUT
Q7) Write a Program to check if the input string is Palindrome or not.
Solution:
OUTPUT
Q8) Write a Program that receives marks of a student for a subject as
input and assign the grades A/B/C/D/E/F.
Solution:
OUTPUT
Q9) Write a Program to compute the GCD of the two numbers.
Solution:
OUTPUT
Q10) Write a Program to check if the given number is Armstrong number
or not. Example: 153, 370, 371 etc.
Solution:
OUTPUT
Q11) Write a Program to check if the input year is a leap year or not.
Solution:
OUTPUT
Q12) Write a Program to compute factorial of a given number.
Solution:
OUTPUT
Q13) Write a Program to generate Fibonacci series till 100.
Solution:
OUTPUT
Q14) Write a Program to print a multiplication table of a given number.
Solution:
OUTPUT
Q15) Write a Program to create two lists and perform the following
operations:
1) Add the Elements of the two lists.
2) Compare the contents of the two lists.
3) Find the number of elements in the lists.
4) Sort the elements of the lists.
5) Reverse the contents of the lists.
Solution:
OUTPUT
Q16) Write a Program to create and display the content of the tuple.
Initialize the tuple with the name of the cities. Display content of the
tuple along with name/index positions of the cities.
Solution:
OUTPUT