r/badcode • u/DecentPattern8884 • Dec 08 '22
python python atrocious code. it appends a letter for how many ; you have in a text file.
462
Upvotes
r/badcode • u/DecentPattern8884 • Dec 08 '22
151
u/MOM_UNFUCKER Dec 08 '22
Loops (and conditionals) are like the second thing people learn after variables when starting out with programming. What the fuck went wrong with this one?
45
u/rotteegher39 Dec 08 '22 edited Dec 09 '22
Is this a christmas tree?
33
u/miran248 Dec 08 '22
Condition for
Qcontainsl, might be a feature, only op knows.25
u/Paul_Robert_ Dec 08 '22
Wait there are no elifs, if the user enters ;;;; , it will output 1234
17
u/LeagueJunior9782 Dec 08 '22
Why is this code so overly complicated? Also why does it exist? Is this a failed attempt of creating semislang?
169
u/apola Dec 08 '22
why tho
10
u/kkjdroid Dec 08 '22 edited Dec 08 '22
Not sure if this is intended, but e.g.
';;;'will result in'ABC', not'C', so';;;;;;;; ;;;;; ;;;;;;;;;;;; ;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;; ;;;;'would result in'ABCDEFGH ABCDEABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLMNOABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWABCDEFGHIJKLMNOABCDEFGHIJKLMNOPQRABCDEFGHIJKLABCD'rather than'HELLO WORLD'.44
u/ChopChopZacZac Dec 08 '22
;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ;;;;;;;;;;;; ;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;; ;;;;;;;; ;;;;;;;;; ;;;;;;;;;;;;;; ;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;; ;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;; ;;;;;;; ? ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;; ;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;; ;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;; ;;;;;;;;; ;;;; ;;;; ;;;;;;;;; ;;;;;;;;;;;;;; ;;;;;;;
32
u/Bishop8- Dec 08 '22
when you get paid per line of code
22
u/Alternative_Wafer709 Dec 08 '22
any thought about count() function and array storing letters xD
17
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Dec 08 '22 edited Dec 08 '22
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
1
u/HorochovPL Dec 09 '22
Oh man... At least You could have used str(";;"*3)
3
u/[deleted] Dec 08 '22
I once graded a kid's for statement homework that was 10 (for x=0; x<1; x++) i++; statements. I mean, technically he added to 10, even if it was in the stupidest way possible.
3
u/CastielUK Dec 08 '22
This won't even work since there's an l Instead of a ; in Q. Brilliant.
2
u/BeantreeKen Dec 08 '22
The pyramids truly are a marvel of human engineering
2
u/shiroe314 Dec 08 '22
Not sure about python int character casting.
But another thing is, given this pattern you would likely do int char conversions.
1
u/variance-explained Dec 08 '22
Lol
1
u/quisatz_haderah Dec 08 '22
Even if this was made with loops... Why?
1
u/gharlane0073 Dec 08 '22
Unary encoding at its finest
1
u/aintnufincleverhere Dec 08 '22
Languages should really come up with a way to do this more efficiently.
1
u/GrismundGames Dec 09 '22
It's the right half of a Christmas tree.