0% found this document useful (0 votes)
56 views

Python Programming Questions

The document contains 100 questions about writing programs (WAPs) to perform various tasks like checking data types, manipulating strings and lists, and more. The questions cover a wide range of programming concepts and require writing code without using built-in functions.

Uploaded by

rashu12345
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Python Programming Questions

The document contains 100 questions about writing programs (WAPs) to perform various tasks like checking data types, manipulating strings and lists, and more. The questions cover a wide range of programming concepts and require writing code without using built-in functions.

Uploaded by

rashu12345
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Questions On Programming session

1. WAP to check the given string is starts with upper case or not.
2. WAp to check it the given value is string or not.
3. WAP to check weather num-1 is greater or not.
4. WAP to check given string is startswith vowels or not.
5. WAP to check given number is divisible by 5 and 3.
6. WAP to check given number is even or odd.
7. WAP to check first digit of given number is even or odd.
8. WAP to convert given string into uppercase.
9. WAP to convert upper to lower or lower to upper.
10. WAP to check number of elements present in list, if it is even print
Good morning else print good evening.
11. WAP to check given char is Special symbol or not.
12. WAP to check middle element of the list is even or not.
13. WAP to check whether the given value is divisible by 6 or not, if
divisible by 6 print cube of that value or else perform left shift operation
step 3.
14. WAP to check two values are pointing to same memory address or not, if
same memory address print memory address of values or else print type of that
data.
15 WAP to check given value is present in that collection or not.
16. WAP to check which is the smallest number among 3 numbers.
17. WAP to find the second greatest number among three numbers.
18 WAP to print series of 20 natural numbers.
19 WAP to print the series of upper case characters.
20 WAP to print the series of upper case characters in reverse.
21 WAP to print series of even numbers till 20 in reverse.
22. WAP to print multiple of given number. (input from user)
23. WAP to count number of accurances of specified element in that
collection.
24. WAP to find the position of first accurance of the specified character.
25. WAP to replace specified character by given new character without using
inbuilt method. (replace "a" with "b")
26. WAP to store all the data items inside the collection without using
builtin methods
27.WAP to store all the data items inside the collection in reverse order
without using builtin methods
28. WAP to append each and every value to a list. (extract elements from
nested) with out using list methods.
29 WAP to append each and every value to a list. (extract elements from
nested)
a = ["hai", (2, 3, 4), 4.2+3j, 6,{"a":1, "b" :2}, ["hello", "good",
"morning"],"hai"]
30. WAP to convert a word into upper case.
31. WAP to convert a word into lower case.
32. WAP to print char and its ASCII value to the given sentence.
33. WAP to extract special characters from give string and store in a list.
s = "$hello$ *Good* #morning# @#$%"
34. WAP to split all the words and store in a list without using inbuilt
methods.
35. WAP to join specified string with the elements present in an iterable.
36. WAP to return position of first accured specifies character
37 WAP to return position of first accured specifies character without using
inbuit method and without using range.
38. WAP to print words in separate line from the given string.
39. WAP to count number of vowels present in given string:
40. WAP to reverse characters in words in a list.
41. WAP to reverse characters in words and also list. (without using inbuilt
method)
42.WAP to perform strip operation without using strip inbuilt method by
taking user input.
43. WAP to perform insert operation in string.
44. WAP to perform clear operation in list without using inbuilt:
45. WAP perform append operation without using append method.
46. WAP perform extend operation without using extend method.
47. WAP to perform copy method to a list without using inbuilt method.
48. WAP to perform reverse operation in list without using inbuilt function.
49. WAP to get given o/p
l = [1, 2, 3, 4, 5, 6, 7, 8, 9]
o/p [1, 2]
[3, 4]
[5, 6]
[7, 8]
[9]
50. WAP to create a list with words if words are of odd length keep it as it is
else reverse it and append.
s = 'hey guys good afternoon welcome to python session'
51. WAP to create a list if the number is even cube it else square it.
l = [1, 2, 4, 5, 8, 19, 3, 56, 43]
52. WAP that returns a list of names starting with vowels in string.
names = ['steve', 'laura', 'bill', 'james', 'bob', 'greg', 'scott']
53. WAP to print names does not start with consonants.
names = ['steve', 'laura', 'bill', 'james', 'bob', 'greg', 'scott']
54. WAP to filter the names which are less than 6 characters.
names = ['apple', 'google', 'yahoo', 'gmail', 'flipkart', 'instagram',
'microsoft']
55. WAP to raise the power of list index
l = [1, 2, 3, 4, 5, 6]
56. WAP to reverse the items of a list if the item is of odd length reverse it else
keep it as it is.
names = ['apple', 'google', 'yahoo', 'gmail', 'flipkart', 'instagram',
'microsoft']
57. WAP to create a dictionary with word and its length pair only if it is even
length.
s = 'hey guys good afternoon welcome to python session'
58. WAP to print index and word pair if word is even length keep it as it is else
reverse it.
s = 'hey guys good afternoon welcome to python session'
59. WAP to flip the keys and values of dictionary using dict comprehension.
d = {'a': 1, 'b': 'hello', 'c': '85', 'd': 12.3, 'e': (1, 2, 3) }
60. WAP to convert to list into a dictionary.
l1 = [10, 20, 30]
l2 = ['hello', 'hai', 'world']
61. WAP to grouping cars and bikes in below list.
items = ['honda-bike', 'audi-car', 'bmw-car', 'apache-bike', 'bullet-bike',
'skoda-car', 'renault-car' ]
62. WAP to check whether the given is palindrome or not. string = 'malayalam'
63. WAP to check whether the string starts with vowel. s = 'Alphabets'
64. WAP to check whether the string endswith vowel. s = 'Python'
65. WAP to reverse a string. s = 'hello world'.
66. WAP to check given number is palindrome or not.(user input)
67. WAP to check if the key is present in dictionary or not
d = {'a': 1, 'b': 2} key = 'c'
68. WAP to check whether given value is string or not.
s = 'Python'
69. WAP to check if the list has even number of elements
l = [1, 2, 3, 4, 6]
70. WAP to check the first element is even or odd.
l = [1, 2, 3, 4, 6]
71. WAP to check the 2nd last number is even or odd.
num = 256473
72. WAP to check greatest of 3 numbers
a =31 b = 23 c = 18
73. WAP to print the result of a student.

74. WAP to convert a string into uppercase to lowercase.


s = 'python'
75. WAP to check whether the given year is leap year or not.
*year = 2000 * year1 = 1996, year2 = 2022

76. WAP to check the number of keys in dictionary, if the number of keys are even
print dictionary as it is, else add a new key to make it even and
print.
d = {'a': 1, 'b':2, 'c': 3}
77.WAP to check whether entered character is vowel or not.(user input)
78. WAP to swap 2 variables with and without using 3rd variable.
79. WAP to check the numbers are divisible by 3 and 4.
80. WAP to check the numbers are divisble by 5 or 6 user input.
81. WALE to return last n elements of any sequence.
82. WALE to convert strings present in list into upper case.
l = ['apple', 'google', 'yahoo']
84. WALE to return the word and its length pair in the given string.
s = 'there is a bunch of flowers'
85. WALE to add the elements in two list.
lst = [10, 20, 30]
lst1 = [1, 2, 3]
86. WALE to raise the elements of the list to the power of indices
numbers = [1, 2, 3, 4, 5]
87.Write a dictionary comprehension to create a dictionary with word as its key and
if the word is of numeric type reverse it else add the word as it isin the
value.
s = '12 plus 18 equals to 30'
88. Write a program to print longest non repeated word in the sentence,
s = 'See and saw went to see a sea'
89. WAF to check the first number is even or not
l = [6,2,3,4]
90.WAF to convert a string into a list and vice versa

91.WAF to find the duplicate elements in the list without using inbuilt functon
92.WAF which takes list of integers & string, if it is string print as it is if it
is integer or float reverse it.
93. Grouping files with same extensions
files = ['apple.txt', 'yahoo.pdf', 'gmail.pdf', 'google.txt',
'amazon.pdf','facebook.txt', 'flipkart.pdf'].
94.WAF to replace value present in nested dictioanry.
replace "nose" with "net"
d = {'a':100, 'b':{"m": 'man', 'n': 'nose', 'o':'ox', 'c':'cat'}}
95. Reverse the values in the dictionary if the value is of type string
di = {'a': 'hello', 'b': 100, 'c': 10.1, 'd': "world"}
96. WAP to find most common words in given list
words = ['look', 'into', 'my', 'eyes', 'look', 'into', 'my', 'eyes', 'the',
'eyes', 'the', 'eyes', 'the', 'eyes', 'not', 'around', 'the', 'eyes',
"don't", 'look', 'around', 'the', 'eyes', 'look', 'into','my', 'eyes', "you're",
'under']
97. Write a program to print longest non repeated word in the sentence,
S = “See and saw went to see a sea”
98. sort the dictionary based on the last character of the key.
prices = {'ACME': 45.23, 'AAPL': 612.78, 'IBM': 205.55, 'HPQ': 37.20,
'FB':10.75 }
99. Write a program to create a dictionary with word and the number of occurrences
of word in the string without using inbuilt method
sentence = 'hello world welcome to python hello hi hello hello'
100. Write a dictionary comprehension to create a dictionary with word as its key
and if the word is of numeric type reverse it else add the word as it is in
the value.
s = '12 plus 18 equals to 30'

You might also like