🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

एक स्ट्रिंग x=”hello” दिया गया x.count('l') का आउटपुट क्या है?

Given a string x=”hello” What is the output of x.count(‘l’) ?

A)
B)
C)
D)

Explanation:

The count() method in Python counts how many times a specified substring appears in a string.

For the string x = "hello", if you call x.count('l'), it counts the occurrences of the character 'l'.

  • In the string "hello", the letter 'l' appears 2 times.

Thus, the output is:

(A) 2

Latest Updates