this post was submitted on 25 Oct 2024
1 points (100.0% liked)
TechTakes
1432 readers
16 users here now
Big brain tech dude got yet another clueless take over at HackerNews etc? Here's the place to vent. Orange site, VC foolishness, all welcome.
This is not debate club. Unless it’s amusing debate.
For actually-good tech, you want our NotAwfulTech community
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Hell, I could probably special-case that shit, and I'm barely a programmer.
Update: As a matter of fact, I did. Here's some Python code to prove it:
There's probably a bug or two in this I missed, but hey, it still proves I'm more of a programmer than Sam Altman ever will be.
the
for x in y
statement takes iterabley
and assigns a value from it tox
per iteration (loop), so what happens is that it's reassigningchosen_char
each loop to the next item from the sentence(
sum([x for x in sentence if x == chosen_char])
would be a quick one-liner, presuming one has downcased the sentence and other input/safety checks)(e: this post was in response to your 2-liner comment in the code)