1. How would you confirm that 2 strings have the same identity?
True
2. How would you check if each word in a string begins with a capital letter?
True
3. Check if a string contains a specific substring
True
4. Find the index of the first occurrence of a substring in a string
19
0 -1 0
5. Count the total number of characters in a string
No of count of i is 3
7. Capitalize the first character of a string
Capitalize the first character of a string Arabinda mohapatra
8. What is an f-string and how do you use it?
My name isArabinda,Mohapatra
9. Search a specific part of a string for a substring
23
10. Interpolate a variable into a string using format()
That tough was level of exam!
11. Check if a string contains only numbers
True
12. Split a string on a specific character
['This', 'is', 'great'] ['not', 'so', 'great']
13. Check if a string is composed of all lower case characters
False
14. Check if the first character in a string is lowercase
False
15. Can an integer be added to a string in Python? Ans:It will through an error 16. Reverse the string “hello world”
r056RBC adnoH
'r056RBC adnoH'
17. Join a list of strings into a single string, delimited by hyphens
'H-o-n-d-a- -C-B-R-6-5-0-r'
18. Check if all characters in a string conform to ASCII
True
19. Uppercase or lowercase an entire string 20-When would you use rfind()?
39
21-Remove vowels from a string
'Hll 1 Wrld 2'
22-Does defining a string twice (associated with 2 different variable names) create one or two objects in memory?
Id of Country is 1407903792688 Id of Desh is 1407903792688
23. What does it mean for strings to be immutable in Python?
1407899591184 1407903616912
24. Give an example of using maketrans() and translate()
'123 1re the firSt three letterS'
25. Give an example of using the partition() function
('India ', 'is', ' my country')
26. Concatenate two strings
ram shyam
27. Capitalize the first character of each word in a string
India Is My Country
28. Check if all characters are whitespace characters
False True
29. Check if a string begins with or ends with a specific character?
True False
No comments:
Post a Comment