0% found this document useful (0 votes)
4 views4 pages

Python

The document contains a comprehensive list of programming exercises categorized into various topics including Basic Input & Output, Loops, Conditionals, Strings, Lists, Tuples & Sets, Dictionaries, Functions, and Miscellaneous. Each category includes a series of questions aimed at testing and enhancing programming skills in Python. The exercises cover fundamental concepts such as arithmetic operations, string manipulation, data structures, and algorithmic problem-solving.

Uploaded by

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

Python

The document contains a comprehensive list of programming exercises categorized into various topics including Basic Input & Output, Loops, Conditionals, Strings, Lists, Tuples & Sets, Dictionaries, Functions, and Miscellaneous. Each category includes a series of questions aimed at testing and enhancing programming skills in Python. The exercises cover fundamental concepts such as arithmetic operations, string manipulation, data structures, and algorithmic problem-solving.

Uploaded by

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

🔹 Basic Input & Output (10 Questions)

1. Take two numbers as input and print their sum.


2. Take a number as input and print its square.
3. Take the user’s name and print “Hello, name!”.
4. Take two numbers and print the larger one.
5. Take three numbers and print the smallest one.
6. Take a number and print if it is positive, negative, or zero.
7. Take a string input and print its length.
8. Take a word and print it in reverse.
9. Take a sentence and print the number of words.
10. Take a character and print whether it is a vowel or consonant.

 Length count krta hai = len(variable)


 Reverse krata hai string ko = variable[::-1]
 Word ko alg alg krta hai aik string ka = split(variable)

🔹 Loops (15 Questions)


11. Print numbers from 1 to 10 using a loop.
12. Print all even numbers from 1 to 50.
13. Print all odd numbers from 1 to 50.
14. Print the multiplication table of a given number.
15. Print the factorial of a number.
16. Print the sum of numbers from 1 to n.
17. Print all prime numbers between 1 and 100.
18. Print the Fibonacci series up to n terms.
19. Print the digits of a number one by one.
20. Print the sum of digits of a number.
21. Count the number of even and odd digits in a number.
22. Reverse a number using a loop.
23. Print all numbers divisible by 7 between 1 and 100.
24. Print numbers from 100 down to 1.
25. Print the square of the first 10 natural numbers.

🔹 Conditionals (10 Questions)


26. Check if a number is even or odd.
27. Check if a number is divisible by 5.
28. Check if a year is a leap year.
29. Check if a number is prime.
30. Check if a string is a palindrome.
31. Check if a number is Armstrong (like 153 = 1³+5³+3³).
32. Check if a number is perfect (like 28).
33. Check if two strings are anagrams.
34. Find the largest of three numbers.
35. Check if a character is uppercase, lowercase, digit, or special symbol.

🔹 Strings (10 Questions)


36. Count vowels in a string.
37. Count consonants in a string.
38. Count digits in a string.
39. Count spaces in a string.
40. Convert a string to uppercase without using .upper().
41. Convert a string to lowercase without using .lower().
42. Find the frequency of each character in a string.
43. Remove vowels from a string.
44. Replace spaces with - in a string.
45. Find the longest word in a sentence.

🔹 Lists (15 Questions)


46. Find the sum of all elements in a list.
47. Find the maximum element in a list.
48. Find the minimum element in a list.
49. Find the second largest element in a list.
50. Count even numbers in a list.
51. Count odd numbers in a list.
52. Remove duplicates from a list.
53. Sort a list without using sort().
54. Reverse a list without using reverse().
55. Merge two lists.
56. Find common elements in two lists.
57. Find elements that are in one list but not in the other.
58. Rotate a list by k positions.
59. Find the frequency of each element in a list.
60. Print a list in pairs (e.g., [1,2,3,4] → (1,2), (3,4)).

🔹 Tuples & Sets (10 Questions)


61. Create a tuple and access its elements.
62. Convert a list to a tuple.
63. Find the length of a tuple.
64. Check if an element exists in a tuple.
65. Create a set and add elements.
66. Remove an element from a set.
67. Find union of two sets.
68. Find intersection of two sets.
69. Find difference of two sets.
70. Check if one set is a subset of another.

🔹 Dictionaries (10 Questions)


71. Create a dictionary and print it.
72. Add a key-value pair to a dictionary.
73. Update the value of an existing key.
74. Delete a key from a dictionary.
75. Print all keys of a dictionary.
76. Print all values of a dictionary.
77. Find the length of a dictionary.
78. Merge two dictionaries.
79. Count frequency of words in a sentence using dictionary.
80. Find the key with the maximum value in a dictionary.

🔹 Functions (10 Questions)


81. Write a function to find the square of a number.
82. Write a function to return the factorial of a number.
83. Write a function to check if a number is prime.
84. Write a function to reverse a string.
85. Write a function to find the GCD of two numbers.
86. Write a function to find the LCM of two numbers.
87. Write a function to check if a string is palindrome.
88. Write a function to generate Fibonacci series.
89. Write a function to find the largest element in a list.
90. Write a function to count vowels in a string.

🔹 Miscellaneous (10 Questions)


91. Swap two numbers without using a third variable.
92. Convert Celsius to Fahrenheit.
93. Convert Fahrenheit to Celsius.
94. Find the area of a circle.
95. Find the area of a triangle.
96. Find the perimeter of a rectangle.
97. Convert decimal to binary.
98. Convert binary to decimal.
99. Generate a random number between 1 and 100.
100. Create a simple calculator (add, subtract, multiply, divide).

You might also like