Schal330@lemmy.world to Programmer Humor@programming.dev · 3 months agoIt must be a silent Rlemmy.worldimagemessage-square114fedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageIt must be a silent Rlemmy.worldSchal330@lemmy.world to Programmer Humor@programming.dev · 3 months agomessage-square114fedilink
minus-squarecypherix93@lemmy.worldlinkfedilinkEnglisharrow-up0·3 months ago"strawberry".split('').filter(c => c === 'r').length
minus-squareSpaceNoodle@lemmy.worldlinkfedilinkarrow-up0·3 months agolen([c if c == ‘r’ for c in “strawberry”])
minus-squareMrLLM@ani.sociallinkfedilinkEnglisharrow-up0·3 months agoimport re; r = [c for c in re.findall("r", "strawberry")]; r = "".join(r); len(r)
minus-squareAwkwardLookMonkeyPuppet@lemmy.worldlinkfedilinkEnglisharrow-up0·3 months agoAre you implying that it’s running a function on the word and then giving a length value for a zero indexed array?
minus-squareTiefling IRL@lemmy.blahaj.zonelinkfedilinkarrow-up0·3 months ago'strawberry'.match(/r/ig).length
minus-squareanti-idpol action@programming.devlinkfedilinkarrow-up0·3 months ago(\r (frequencies “strawberry”))
"strawberry".split('').filter(c => c === 'r').length
len([c if c == ‘r’ for c in “strawberry”])
import re; r = [c for c in re.findall("r", "strawberry")]; r = "".join(r); len(r)
Are you implying that it’s running a function on the word and then giving a length value for a zero indexed array?
'strawberry'.match(/r/ig).length
(\r (frequencies “strawberry”))