Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-135

Emoji Detection Count

Problem

Count emoji characters in text using code point ranges: U+1F300 to U+1FAFF and U+2600 to U+27BF.

Characters outside those ranges do not count, and empty text yields 0.

Hint

Compare ord(ch) against the two inclusive ranges.

Test cases

case 1
in: ["hi 😀😀"]
expected: 2
case 2
in: ["no emoji"]
expected: 0
case 3
in: ["❤"]
expected: 1
case 4
in: ["a✨b🚀"]
expected: 2
case 5
in: [""]
expected: 0
Starter codePython
def emoji_count(text):
    # Your code here
    pass

5 test cases · run your code against them in the editor