PYTHON Interview Questions and Answers
Question - 81 : - How will you change case for all letters in string?
Answer - 81 : - swapcase() − Inverts case for all letters in string.
Question - 82 : - How will you get titlecased version of string?
Answer - 82 : - title() − Returns "titlecased" version of string, that is, all words begin with uppercase and the rest are lowercase.
Question - 83 : - How will you convert a string to all uppercase?
Answer - 83 : - upper() − Converts all lowercase letters in string to uppercase.
Question - 84 : - How will you check in a string that all characters are decimal?
Answer - 84 : - isdecimal() − Returns true if a unicode string contains only decimal characters and false otherwise.
Question - 85 : - What is the difference between del() and remove() methods of list?
Answer - 85 : - To remove a list element, you can use either the del statement if you know exactly which element(s) you are deleting or the remove() method if you do not know.
Question - 86 : - What is the output of len([1, 2, 3])?
Answer - 86 : - 3.
Question - 87 : - What is the output of [1, 2, 3] + [4, 5, 6]?
Answer - 87 : - [1, 2, 3, 4, 5, 6]
Question - 88 : - What is the output of ['Hi!'] * 4?
Answer - 88 : - ['Hi!', 'Hi!', 'Hi!', 'Hi!']
Question - 89 : - What is the output of 3 in [1, 2, 3]?
Answer - 89 : - True
Question - 90 : - What is the output of for x in [1, 2, 3]: print x?
Answer - 90 : - 1 2 3