Python Interview Questions 4

31.How will you capitalizes first letter of string?
capitalize() − Capitalizes first letter of string.

32.How will you check in a string that all characters are digits?
isdigit() − Returns true if string contains only digits and false otherwise.

33.How will you check in a string that all characters are alphanumeric?
isalnum() − Returns true if string has at least 1 character and all characters are alphanumeric and false otherwise.

34.How will you check in a string that all characters are in lowercase?
islower() − Returns true if string has at least 1 cased character and all cased characters are in lowercase and false otherwise.

35.How will you check in a string that all characters are numerics?
isnumeric() − Returns true if a unicode string contains only numeric characters and false otherwise.

36.How will you check in a string that all characters are whitespaces?
isspace() − Returns true if string contains only whitespace characters and false otherwise.

37.How will you check in a string that it is properly titlecased?
istitle() − Returns true if string is properly "titlecased" and false otherwise.

38.How will you check in a string that all characters are in uppercase?
isupper() − Returns true if string has at least one cased character and all cased characters are in uppercase and false otherwise.

39.How will you merge elements in a sequence?
join(seq) − Merges (concatenates) the string representations of elements in sequence seq into a string, with separator string.

40.How will you get the length of the string?
len(string) − Returns the length of the string.

No comments:

Post a Comment