Robotics & Artificial Intelligence
What would be the output of following code?
Q1 = "Hello How are you"
val = Q1.count("H")
print(val)
- 1
- 2
- 3
- 4
Python String Manipulation
2 Likes
Answer
2
Reason — The count() function returns the number of occurrences of a character in a string. In the string "Hello How are you", the character "H" appears two times, therefore the output is 2.
Answered By
2 Likes
Related Questions
Which of the following function is applicable in a tuple?
- insert
- append
- del
- None of these
What would be the output of following code?
str1 = "Hello India" s1 = str1[1:3] print(s1)- He
- el
- Hlo
- None of these
What are the warehouse robots and how are they used in the logistics industry?
What do you understand by cobots? Explain.