Question Bank
Question Bank
1. The XYZ is a shop that sells clothes at different discounted prices as below.
>25000 50%
<5000 No Discount
Write a program to take the total bill value as input and calculate the discount amount and discounted
2. Write a Python program to verify whether the given number is an Armstrong number or Not. For
example ‘Armstrong number is’: 1^3 + 5^3 + 3^3 equal to 153. : 2^4 + 0^4 + 2^4 + 4^4 not equal
3. Write a Python program using functions to find the value of nPr and nCr.
b) Write a Python program to find the minimum length of the given three strings without using
inbuilt functions.
c) Python program to counts how many times each word appears in the sentence.
9. Write Python program to convert one base into any base (Binary, Decimal, Octal, Hexa)
10. Differentiate between List, Tuple & Set with suitable examples of each. Explain any three
12. Write Pythonic code to multiply two matrices using nested loops.
13. Write a Python program for the following scenario: Let the first three numbers of the series be
14. Write a Python program to calculate the smallest common divisor (except 1) of given two
a. Tower of Hanoi
b. Sudoku (Sum of diagonals, sum of rows, sum of columns should be 15 / Numbers from 1
c. Calculator
d. Age calculator
e. N queen problem
17. a) Create a Python program to remove the nth index character from a nonempty string.
b)Discuss control flow statements in Python with examples. Write a Python program to create a
vending machine that allows users to interact with a virtual machine where they can:
a. Insert money
18. Create a Python program to count the occurrences of each word in each sentence.
19. Analyse the given code. Write and justify the output:
a=20
b=20
print(a&b)
print(a|b)
print(a^b)
print(~a)
20. Write a program to display the pattern given as follows
* * * * * * 1
* * * * * * 1 2
* * * * * * 1 2 3
* * * * * * 1 2 3 4
* * * * * * 1 2 3
1 2
1
21. a) Create a class with following criteria:
Method: display ()
b) Design a simple banking system using classes where you can create an account, deposit money,
22. Write a Python Program to check if three points (x1, y1), (x2, y2), (x3, y3) are collinear.
23. What is a module and package in Python? Explain how can you access a module written in Python.
Give an example of package creation in Python.
24. Elucidate the below function in Python List with an example.
a) del
b) remove
c) sort
d) insert
e) pop
f) slicing
25. Write a Python program to find the length of the longest word in a given sentence.
26. Write a python programming to calculate the total bill value including GST (CGST & SGST -12%).
Product Value
S.No Product
120
Kukure
1
60
Brittania Cake
2
Oreao-Chocolate Biscuits 40
3
35
Lassi
4
27. Explain exception handling in python write a python program that demonstrate the use of try,
28. Write a python program to check the validity of passwords input by users
29. You are tasked with creating a Python class Book that represents a book in a library system. The
class should include the following: