0% found this document useful (0 votes)
3 views3 pages

Programs Worksheet

Uploaded by

Tanu Jain
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 views3 pages

Programs Worksheet

Uploaded by

Tanu Jain
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

USING FUNCTIONS

PROGRAMS
1. To check whether number entered by user is prime or not.
2. To check whether number entered by user is palindrome or not.
3. To check whether number entered by user is a perfect square or not.
4. To accept a number from the user and display whether it is even/odd,
positive/negative/zero.
5. To display the reverse of a number entered by user.
6. To check the number entered by user is Armstrong or not.
7. To accept three numbers from the user and print the largest of the three.
8. To print the Fibonacci series upto n where n is entered by user.

STRINGS PROGRAMS
1. To input a string and check if it is a palindrome string or not.
2. To input a line of text and prints number of uppercase letters, alphabets,
lowercase letters, digits and symbols.
3. To read a line of text and a substring. Display the number of occurrences of
the given substring in the text.
4. To read a line of text and display the longest substring.
5. To input a string and check if it contains a digit or not.
6. To input a line of text. Display each word in a separate line after change
case of each letter. (like uppercase to lowercase and vice versa)
7. To input a string and print each individual word of it along with its length.
8. To input a line of text and display string after removing all punctuations.
9. To input a string and display number of uppercase and lowercase letters in
it.
10. To input a line of text and create a new line of text where each word of
input line is reversed.

LIST PROGRAMS
1. To find the minimum element from a list of elements along with its index in
the list.
2. To calculate the mean of a given list of numbers.
3. To search for an element in a given list of numbers.
4. To find and print frequencies of all elements of a list. Also print the list of
unique elements in the list and duplicate elements in the list.
5. To input a list and an element and remove all occurrences of the given
element from the list.
6. To input a list and reverse it.
7. To input a list of numbers and display all even elements first followed by all
odd elements.
8. To input a list of numbers and ask M and N from the user. Display those
elements that are divisible by M and N both.
9. To input a list of n integers. Create two lists, one having positive elements,
other having negative elements and display all three lists.
10. To input a list of integers. Calculate and display the sum of all odd numbers
in the list.

TUPLES PROGRAMS
1. To check if there are multiple maximum elements in a tuple or not.
2. A tuple stores marks of a student in 5 subjects. To calculate the grade of the
students as per the following: >=75 Grade A, 60-74.999 Grade B, 50-59.999
Grade C, <50 Grade D
3. To create a tuple storing first 10 terms of Fibonacci series.
4. To check if a tuple contains any duplicate elements.
5. To check if the elements in the first half of a tuple are sorted in ascending
order or not.
6. To input a list of tuple and display the tuple after squaring each even
number and cube each odd number.
7. To check if the minimum element of a tuple lies at the middle position of
the tuple.
8. To input names of n students and store them in a tuple. Also input a name
from the user and find if this student is present in the tuple or not.
9. To input a tuple of n integers. Create two tuples, one having positive
elements, other having negative elements and display all three tuples.
10. To input a tuple of integers. Calculate and display the sum of all odd
numbers and even numbers separately in the tuple.
DICTIONARY PROGRAMS
1. To input the number of students. Create a dictionary M that stores the
marks of the students of class with roll numbers as the keys and marks as
the values.
2. Use the dictionary created above, check if anyone has scored marks as 89.9.
3. Use the dictionary created in Q1, ask a roll number from the user and
delete it from the dictionary. Display error message if the roll number does
not exist in the dictionary.
4. To print the maximum, minimum, sum of keys of numbers dictionary as
shown: numbers={1:111, 2:222, 3:333, 4:444}
5. To create a dictionary with the roll number, name and marks of n students
in a class and display the names of students who have marks above 75.

Also solve all output based questions from the back exercise of
chapters- Strings, Lists, Tuples and Dictionary.

You might also like