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

Practice Programs

The document contains a comprehensive list of programming exercises categorized into three sections: Practice Programs, Dictionary, and For Loop. Each section includes various tasks such as finding sums, sorting lists, and manipulating dictionaries. The exercises are designed to enhance programming skills through practical application.

Uploaded by

sasipreetham2201
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)
11 views3 pages

Practice Programs

The document contains a comprehensive list of programming exercises categorized into three sections: Practice Programs, Dictionary, and For Loop. Each section includes various tasks such as finding sums, sorting lists, and manipulating dictionaries. The exercises are designed to enhance programming skills through practical application.

Uploaded by

sasipreetham2201
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/ 3

Practice Programs

List

1. Write a program to find the sum of all elements in a list.


2. Write a program to find the largest element in a list.
3. Write a program to find the smallest element in a list.
4. Write a program to find the average of all elements in a list.
5. Write a program to find the median of all elements in a list.
6. Write a program to remove all duplicates from a list.
7. Write a program to sort a list in ascending order.
8. Write a program to sort a list in descending order.
9. Write a program to reverse a list.
10. Write a program to find the second largest element in a list.
11. Write a program to find the second smallest element in a list.
12. Write a program to merge two lists and sort them.
13. Write a program to check if a list is empty.
14. Write a program to check if a list is palindrome.
15. Write a program to remove the nth element from a list.
16. Write a program to remove all occurrences of an element from a list.
17. Write a program to count the number of occurrences of an element in a list.
18. Write a program to find the index of an element in a list.
19. Write a program to insert an element at a specific position in a list.
20. Write a program to remove all elements from a list except the first and the last.
21. Write a program to find the sum of all elements in a list.
22. Write a program to find the product of all elements in a list.
23. Write a program to find the maximum and minimum elements in a list.
24. Write a program to find the second largest and second smallest elements in a list.
25. Write a program to remove all duplicates from a list.
26. Write a program to remove all elements from a list that are divisible by a given number.
27. Write a program to remove all elements from a list that are less than a given number.
28. Write a program to remove all elements from a list that are greater than a given number.
29. Write a program to remove all elements from a list that are not in another list.
30. Write a program to reverse a list using slicing.
31. Write a program to rotate a list by a given number of positions.
32. Write a program to shuffle a list randomly.
33. Write a program to find the difference between two lists.

Dictionary
1. Write a program to print all the keys of a dictionary.
2. Write a program to print all the values of a dictionary.
3. Write a program to print all the items of a dictionary.
4. Write a program to find the length of a dictionary.
5. Write a program to check if a key is present in a dictionary.
6. Write a program to check if a value is present in a dictionary.
7. Write a program to add a key-value pair to a dictionary.

IGNITZ SOLUTIONS
8. Write a program to remove a key-value pair from a dictionary.
9. Write a program to clear a dictionary.
10. Write a program to copy a dictionary.
11. Write a program to get the value for a given key in a dictionary.
12. Write a program to update the value for a given key in a dictionary.
13. Write a program to remove a key from a dictionary.
14. Write a program to sort a dictionary by key.
15. Write a program to sort a dictionary by value.
16. Write a program to find the largest value in a dictionary.
17. Write a program to find the smallest value in a dictionary.
18. Write a program to find the largest key in a dictionary.
19. Write a program to find the smallest key in a dictionary.
20. Write a program to concatenate two dictionaries.

For Loop
1. Write a program to print the multiplication table of a given number.
2. Write a program to print the Fibonacci series up to a given number.
3. Write a program to find the factorial of a given number.
4. Write a program to print the first n prime numbers.
5. Write a program to find the sum of all natural numbers from 1 to n.
6. Write a program to print the ASCII values of all the characters in a string.
7. Write a program to print the squares of all the numbers in a list.
8. Write a program to print the cubes of all the numbers in a list.
9. Write a program to print the reverse of a string.
10. Write a program to print the reverse of a list.
11. Write a program to find all the prime numbers between a given range using for loop.
12. Write a program to find the factorial of a given number using for loop.
13. Write a program to find the Fibonacci series up to a given number using for loop.
14. Write a program to find the prime factors of a given number using for loop.
15. Write a program to find the greatest common divisor of two given numbers using for loop.
16. Write a program to find the least common multiple of two given numbers using for loop.
17. Write a program to find the sum of all natural numbers up to a given number using for loop.
18. Write a program to find the sum of all even numbers up to a given number using for loop.
19. Write a program to find the sum of all odd numbers up to a given number using for loop.
20. Write a program to find the sum of all numbers in each range using for loop.
21. Write a program to find the sum of all digits of a given number using for loop.
22. Write a program to find the reverse of a given number using for loop.
23. Write a program to find the number of digits in each number using for loop.
24. Write a program to find the sum of digits of a given number until the sum becomes a single
digit using for loop.
25. Write a program to find all the Armstrong numbers between a given range using for loop.
26. Write a program to find all the perfect numbers between a given range using for loop.
27. Write a program to find all the abundant numbers between a given range using for loop.
28. Write a program to find all the palindrome numbers between a given range using for loop.
29. Write a program to find all the strong numbers between a given range using for loop.
30. Write a program to find all the happy numbers between a given range using for loop.

IGNITZ SOLUTIONS
31. Write a program to find all the Smith numbers between a given range using for loop.
32. Write a program to find all the ugly numbers between a given range using for loop.
33. Write a program to find all the abundant numbers between a given range using for loop.
34. Write a program to find all the odd numbers between a given range using for loop.
35. Write a program to find all the even numbers between a given range using for loop.
36. Write a program to find all the perfect squares between a given range using for loop.
37. Write a program to find all the factors of a given number using for loop.
38. Write a program to find all the divisors of a given number using for loop.
39. Write a program to find all the common elements in two lists using for loop.
40. Write a program to find all the unique elements in a list using for loop.

IGNITZ SOLUTIONS

You might also like