XI CH-4, String (Assign)
XI CH-4, String (Assign)
5. Which method convert String "welcome to the beautiful world of python" into "Welcome
To The Beautiful World Of Python"
a) capitalize() b) upper() c) isupper() d) title()
12.If a string , S2=”Loves One and All” . What would be returned by following string slices
a. S2[-7: -3]
b. S2[9:] + S2[:9]
c. S2 [10 : 12]
8. What is the use of isupper( ) and isalnum( ) methods in python explains with example.
String. isupper( ) - The isupper() method returns True if all the characters are in upper case,
otherwise False.
E.g. A="hello"
B = "THERE"
A. isupper () False
B. isupper () True
String. isalnum( ) – The isalnum() return True if the character in the string are alphanumeric,
meaning alphabet letter (a-z) and numbers (0-9).
E.g. A="abc123" B = "1234" C="7000"
A. isalnum() True
B. isalnum() True
C. isalnum() True
9. a="Hello" and a='Hello'. Does it makes any difference or is it same in python. Justify.
No , Both are the way to declare string in Python
11. If a string , S1=”Loves One and All” Write the Python expression using string slices
e. ‘One an’
f. ‘d All ’
g. ‘AND’
h. ‘ Loves’
12.If a string , S2=”Loves One and All” . What would be returned by following string slices
a. S2[-7: -3]
b. S2[9:] + S2[:9]
c. S2 [10 : 12]