Python Basic Questions
Python Basic Questions
+91-9010607010 [email protected]
Narayana Tech House
25. What are Python's dictionaries?
26. How will you create a dictionary in python?
27. How will you get all the keys from the dictionary?
28. How will you get all the values from the dictionary?
29. How will you convert a string to an int in python?
30. How will you convert a string to a long in python?
31. How will you convert a string to a float in python?
32. How will you convert a object to a string in python?
33. How will you convert a string to a tuple in python?
34. How will you convert a string to a list in python?
35. How will you convert a string to a set in python?
36. How will you create a dictionary using tuples in python?
37. How will you convert a string to a frozen set in python?
38. How will you convert an integer to a character in python?
39. How will you convert a single character to its integer value in python?
40. What is the purpose of ** operator?
41. What is the purpose of // operator?
42. What is the purpose of is operator?
43. What is the purpose of not in operator?
44. What is the purpose break statement in python?
45. What is the purpose continue statement in python?
46. What is the purpose pass statement in python?
47. How can you pick a random item from a list or tuple?
48. How can you pick a random item from a range?
49. How can you get a random number in python?
50. How will you set the starting value in generating random numbers?
51. How will you capitalizes first letter of string?
52. How will you check in a string that all characters are alphanumeric?
53. How will you check in a string that all characters are digits?
54. How will you check in a string that all characters are in lowercase?
55. How will you check in a string that all characters are numerics?
56. How will you check in a string that all characters are whitespaces?
57. How will you check in a string that it is properly titlecased?
58. How will you check in a string that all characters are in uppercase?
59. How will you merge elements in a sequence?
60. How will you get the length of the string?
61. How will you get a space-padded string with the original string left-justified to a total of width
columns?
62. How will you convert a string to all lowercase?
63. How will you remove all leading whitespace in string?
64. How will you get the max alphabetical character from the string?
+91-9010607010 [email protected]
Narayana Tech House
65. How will you get the min alphabetical character from the string?
66. How will you replaces all occurrences of old substring in string with new string?
67. How will you remove all leading and trailing whitespace in string?
68. How will you change case for all letters in string?
69. How will you get titlecased version of string?
70. How will you convert a string to all uppercase?
71. How will you check in a string that all characters are decimal?
72. What is the difference between del() and remove() methods of list?
73. What is the output of len([1, 2, 3])?
74. What is the output of [1, 2, 3] + [4, 5, 6]?
75. What is the output of ['Hi!'] * 4?
76. What is the output of 3 in [1, 2, 3]?
77. What is the output of for x in [1, 2, 3]: print x?
78. What is the output of L[2] if L = [1,2,3]?
79. What is the output of L[-2] if L = [1,2,3]?
80. What is the output of L[1:] if L = [1,2,3]?
81. How will you compare two lists?
82. How will you get the length of a list?
83. How will you get the max valued item of a list?
84. How will you get the min valued item of a list?
85. How will you get the index of an object in a list?
86. How will you insert an object at given index in a list?
87. How will you remove last object from a list?
88. How will you remove an object from a list?
89. How will you reverse a list?
90. How will you sort a list?
+91-9010607010 [email protected]