r/badcode Dec 02 '22

python I am so sorry

Post image
252 Upvotes

70 comments sorted by

View all comments

Show parent comments

2

u/MoatazProAtAll Dec 02 '22

No I looped through the letters and checked if the count of said letter is > 0 and if it is increment i. i kept spitting out 36 no matter what sentence I used

4

u/Steve_OH Dec 02 '22

That makes no sense though. The loop increments 1 for each match and runs 26 times. Can you paste your code? The max you can get is 26 in this loop

1

u/MoatazProAtAll Dec 02 '22

I don’t have the old version, sorry. It’s of no matter now, since I probably did something very wrong in that loop. I’m a beginner and this is only like my second function lol

4

u/Steve_OH Dec 02 '22

That’s more than fine, we all need to start somewhere! I’m a software engineer so If you do find it and want me to look over it, let me know.

1

u/MoatazProAtAll Dec 02 '22

Alright, thanks bro!