[go: up one dir, main page]

0% found this document useful (0 votes)
3 views1 page

Sample qp-2

The document outlines a series of Python programming tasks, including the development of a menu-driven shopping list application, operations on tuples, functions for calculating the sum of digits and checking perfect numbers, and handling exceptions. It also includes tasks for calculating median values, creating a package for banking operations, and checking for palindromes. Each task specifies the required functionality and expected outcomes for the programs.

Uploaded by

avengersthk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Sample qp-2

The document outlines a series of Python programming tasks, including the development of a menu-driven shopping list application, operations on tuples, functions for calculating the sum of digits and checking perfect numbers, and handling exceptions. It also includes tasks for calculating median values, creating a package for banking operations, and checking for palindromes. Each task specifies the required functionality and expected outcomes for the programs.

Uploaded by

avengersthk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1. Develop a menu-driven shopping list application in Python.

The program should allow users to:


• Add new items to the shopping list.
• View all items in alphabetical order.
• Update an existing item (only if the item is not already present).
• Remove an item from the list (only if it exists).
The application should present an interactive menu where users can choose the desired operation and
perform actions dynamically on the shopping list.

2. Create a tuple with set of string values and perform following operation based on user choice.
• If choice is 1 display the element present in last index position
• If choice is 2 display number of elements in the tuple
• If choice is 3 display number of occurrence of the string “hello”
• If choice is 4 find whether the element “python” is present in the list or not
• If it does not satisfy any of the above choice, display "Invalid"
(Same can be asked with list, string, set, tuple and dictionary)

3. Write a function to calculate sum of digits of a given number (input: 23 output:5)

4. Write a Python program to check whether a given number is a perfect number or 10 not. A perfect
number is a number that is equal to the sum of its proper divisors

(excluding the number itself). For example, 6 is a perfect number because its

divisors are 1, 2, and 3, and 1+2+3=6

5. Write a Python program to calculate median value of the given list of elements using
statistics module and write it into the file “classmedian.txt”.

6. Create a Python program to initialize a list and handle index error exception. Raise index
error exception if the length of the list is less than 5.

7. Create a package which contains two modules, one should contains withdraw details and
balance amount and other should display the details of the customer. Write a Python program
to withdraw amount and to display customer details.

8. Create a function to find whether the given string is palindrome or not. If it is palindrome return 1
else return -1. Consider default value of the string as “MADAM”.

You might also like