Practice Programs
Practice Programs
List
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