python question class 12th cs
note- without using inbuilt functions
1. . Which string method is used to implement the following:
a) To count the number of characters in the string.
b) To change the first character of the string in capital letter.
c) To check whether given character is letter or a number.
d) To change lower case to upper case letter.
e) Change one character into another character
Answers
Answered by
2
a) count() method
'<string>'.count('<the character>')
b) capitalize() method
'<string>'.capitalize()
c) isdigit() method
'<char>'.isdigit()
returns True if it is a number (counting), else returns False
d) upper() method
'<string>'.upper()
e) replace() method
'<string>'.replace('<old-char>', '<new-char>')
no functions ;-;
Similar questions