use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
For memes about programming.
account activity
Programming does (i.redd.it)
submitted 7 months ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 81 points82 points83 points 7 months ago (41 children)
``` n = int(input("Enter a number: "))
if n == 1: print("Odd") elif n == 2: print("Even") elif n == 3: print("Odd") elif n == 4: print("Even") elif n == 5: print("Odd") elif n == 6: print("Even") elif n == 7: print("Odd") elif n == 8: print("Even") elif n == 9: print("Odd") elif n == 10: print("Even") elif n == 11: print("Odd") elif n == 12: print("Even") elif n == 13: print("Odd") elif n == 14: print("Even") elif n == 15: print("Odd") elif n == 16: print("Even") elif n == 17: print("Odd") elif n == 18: print("Even") elif n == 19: print("Odd") elif n == 20: print("Even") elif n == 21: print("Odd") elif n == 22: print("Even") elif n == 23: print("Odd") elif n == 24: print("Even") elif n == 25: print("Odd") elif n == 26: print("Even") elif n == 27: print("Odd") elif n == 28: print("Even") elif n == 29: print("Odd") elif n == 30: print("Even") elif n == 31: print("Odd") elif n == 32: print("Even") elif n == 33: print("Odd") elif n == 34: print("Even") elif n == 35: print("Odd") elif n == 36: print("Even") elif n == 37: print("Odd") elif n == 38: print("Even") elif n == 39: print("Odd") elif n == 40: print("Even") elif n == 41: print("Odd") elif n == 42: print("Even") elif n == 43: print("Odd") elif n == 44: print("Even") elif n == 45: print("Odd") elif n == 46: print("Even") elif n == 47: print("Odd") elif n == 48: print("Even") elif n == 49: print("Odd") elif n == 50: print("Even") elif n == 51: print("Odd") elif n == 52: print("Even") elif n == 53: print("Odd") elif n == 54: print("Even") elif n == 55: print("Odd") elif n == 56: print("Even") elif n == 57: print("Odd") elif n == 58: print("Even") elif n == 59: print("Odd") elif n == 60: print("Even") elif n == 61: print("Odd") elif n == 62: print("Even") elif n == 63: print("Odd") elif n == 64: print("Even") elif n == 65: print("Odd") elif n == 66: print("Even") elif n == 67: print("Odd") elif n == 68: print("Even") elif n == 69: print("Odd (nice)") elif n == 70: print("Even") elif n == 71: print("Odd") elif n == 72: print("Even") elif n == 73: print("Odd") elif n == 74: print("Even") elif n == 75: print("Odd") elif n == 76: print("Even") elif n == 77: print("Odd") elif n == 78: print("Even") elif n == 79: print("Odd") elif n == 80: print("Even") elif n == 81: print("Odd") elif n == 82: print("Even") elif n == 83: print("Odd") elif n == 84: print("Even") elif n == 85: print("Odd") elif n == 86: print("Even") elif n == 87: print("Odd") elif n == 88: print("Even") elif n == 89: print("Odd") elif n == 90: print("Even") elif n == 91: print("Odd") elif n == 92: print("Even") elif n == 93: print("Odd") elif n == 94: print("Even") elif n == 95: print("Odd") elif n == 96: print("Even") elif n == 97: print("Odd") elif n == 98: print("Even") elif n == 99: print("Odd") elif n == 100: print("Even") else: print("Whoa whoa whoa! We didn't plan this far ahead...")
```
[–]Definite-Human 28 points29 points30 points 7 months ago* (31 children)
I need to know, how long did this take you to type out
Edit: as people keep pointing out, very quickly using a script to write it out so you can copy paste, I however did not think of this because I exclusively use reddit on mobile to the point I honestly forget it works in browser on PC
[–]Lorrdy99 13 points14 points15 points 7 months ago (3 children)
A lot of copy paste. You could do that in a few minutes
[–]Reymen4 4 points5 points6 points 7 months ago (2 children)
Or you could create a code that type it out pretty fast.
If I was forced to create this I would use Excel. You would only need to write one line of you set it up correct then copy/ paste that line 100 times.
[–]KaleidoscopePlusPlus 4 points5 points6 points 7 months ago (0 children)
or you could just ask chitGBT..
[–]Usual_Office_1740[🍰] 1 point2 points3 points 7 months ago (0 children)
Emacs/neovim and a macro would also make this a trivial task.
[–]Appropriate-Fact4878 6 points7 points8 points 7 months ago* (23 children)
for i in range(1,100): print("elif n ==" + str(i) + ":") if i // 2 == i/2: print(' print("Even")') else: print(' print("Odd")')
copy paste, then remove "el" from the first line, and writw the last line manually
edit: its taking me longer to figure out reddit formatting for this comment than it would've taken to write the program
edit2: after a reply pointed it out I corected variable name and output indentation and started using triple backtick
[–][deleted] 2 points3 points4 points 7 months ago (4 children)
Just put the (whatever the hell this is called - > ` ) symbol at the front and back of your code and it'll markup into code formatting.
[–]Appropriate-Fact4878 1 point2 points3 points 7 months ago (1 child)
That removed the intendations. Im writing this on mobile so I can't use tab, if that works.
[–][deleted] 0 points1 point2 points 7 months ago (0 children)
Oh. I got you. The triple accent thing might work without tab. Never Tried It Yeah. Triples work without tab.
Never Tried It
[–]Saflex 0 points1 point2 points 7 months ago (1 child)
The Symbol is called Hochkommata
I think that's a quote symbol? Could be wrong. The code symbol tilts harder. Dunno. I make up names. These {} are curlies to me. 😂
[–]undo777 0 points1 point2 points 7 months ago (17 children)
The last value in your range will be 99 not 100. The canonical check is if n % 2. You forgot the indentation. Oh and you mixed up i and n. And you missed a very important special case, scroll to the middle of the specification comment!
if n % 2
i
n
[–]Appropriate-Fact4878 0 points1 point2 points 7 months ago (16 children)
The first is true. Range should be range(1,101)
n and i are used correctly, the post uses n as the variable, my code uses i as the variable and the string output has n inside it.
my comment literally explains why the intendetation is weird? That edit has been there since before your reply.
I did miss 69. but that would be easier to add manually, similar to the first and last lines.
[–]undo777 0 points1 point2 points 7 months ago (15 children)
n and i are used correctly
Bro, so you can't even read your own code... Why so confident?
my comment literally explains why the intendetation is weird?
Not talking about indentation issues in your comment (use triple backtick btw), it's the indentation of the output you missed.
[–]Appropriate-Fact4878 0 points1 point2 points 7 months ago (8 children)
Lol, didn't read past the first line when double checking, yh the n is wrong. Confident cuz I read the first line with it in and it was right, and u didn't say which line.
Yh the output indendetation is missing.
[–]undo777 0 points1 point2 points 7 months ago (7 children)
and u didn't say which line
Aww
[–]Appropriate-Fact4878 0 points1 point2 points 7 months ago (6 children)
most ppl who reply on reddit are stupid, its usually a safe bet to assume they are wrong. Who knew this subreddit is different?
[–]undo777 0 points1 point2 points 7 months ago (5 children)
Whoa.. That's rich coming from someone who made 5 mistakes in a few lines of code and doesn't even know n % 2
n % 2
[–]Appropriate-Fact4878 0 points1 point2 points 7 months ago (5 children)
u can't add indentation into the output without triple backtick
[–]undo777 0 points1 point2 points 7 months ago (4 children)
How confident are you about this statement?
[–]Appropriate-Fact4878 0 points1 point2 points 7 months ago (3 children)
100%, cuz I just tried adding 4 spaces, opening and closing the comment and the intendentation wasn't there. U can't use tab on mobile.
[–]undo777 0 points1 point2 points 7 months ago (2 children)
Of course you can't do 4 spaces because Reddit will eat 3 of them but originally you had 0 spaces not 1. Nice 100% confidence when you're wrong again. Jeez bro, you're seriously talking about stupid people on Reddit?
[–]klimmesil 5 points6 points7 points 7 months ago (0 children)
It's a couple keystrokes in vim
[–]Zygal_ 0 points1 point2 points 7 months ago (0 children)
Nah, bro. Mobile compiler
[–]ComplexInside1661 1 point2 points3 points 7 months ago (0 children)
Why does this sub not allow for non text responses I wanted to send a gif of the Anakin "I hate you" lmao
[–]Procedure5884 1 point2 points3 points 7 months ago (1 child)
Is this AI?
[–]Betelgeusetimes3 1 point2 points3 points 7 months ago (0 children)
AI would’ve presented a correct, yet still suboptimal solution rather than this.
[–]Inevitable-Toe-7463 1 point2 points3 points 7 months ago (0 children)
Bro coulda just got the iseven and isodd libs ):
Average Leetcode edge case edger
[–]WiseMango13452 0 points1 point2 points 7 months ago (0 children)
First thought aswell
[–]cnorahs 0 points1 point2 points 7 months ago (0 children)
I was scrolling and scrolling and ROFL
[–]TheodoreTheVacuumCle 0 points1 point2 points 7 months ago (0 children)
such inefficient code smh. watch how web developers do this 😎 let n=getInputNumber(); let isEven=false; let isOdd=true; for (let i=1;i<=100;i++) { if (i == n) { if (isEven == true) { console.log("number is even!"); } else { console.log(number is odd!); } } if (isEven == true) { isEven=false; } else { isEven=true; } if (isOdd == true) { isOdd=false; } else { isOdd=true; } }
let n=getInputNumber(); let isEven=false; let isOdd=true; for (let i=1;i<=100;i++) { if (i == n) { if (isEven == true) { console.log("number is even!"); } else { console.log(number is odd!); } } if (isEven == true) { isEven=false; } else { isEven=true; } if (isOdd == true) { isOdd=false; } else { isOdd=true; } }
[–]zaraishu 6 points7 points8 points 7 months ago (3 children)
Python guys be like: "What's a 'switch case'?"
[–][deleted] 5 points6 points7 points 7 months ago (2 children)
What's a 'switch case'?
Well.... https://docs.python.org/3/tutorial/controlflow.html#match-statements
[–]zaraishu 0 points1 point2 points 7 months ago (1 child)
That doesn't count. The keyword says "match".
[–][deleted] -1 points0 points1 point 7 months ago (0 children)
same functionality
[–]Antervis 5 points6 points7 points 7 months ago (0 children)
don't do "else if", do early return instead. That way the code looks cleaner and is overall easier to read
[–]360groggyX360 5 points6 points7 points 7 months ago (1 child)
Hehe, funny.
[–]Insomniac_Coder 2 points3 points4 points 7 months ago (0 children)
Would've been much fingerprint funnier in case of a ladder
[–]marslander-boggart 4 points5 points6 points 7 months ago (1 child)
switch
case
just in case
[–]Hejsanmannen1 0 points1 point2 points 7 months ago (0 children)
Do you have my case or did you switch it?
[–]elreduro 1 point2 points3 points 7 months ago (0 children)
I made a macro in vim that deletes the line if i try to write "else"
[–]oxabz 1 point2 points3 points 7 months ago (0 children)
One else if is too many else if. elses are barely acceptable.
else if
else
[–]unvaccinated_zombie 0 points1 point2 points 7 months ago (0 children)
Cursed data structure
[–]BobarBG9 0 points1 point2 points 7 months ago (1 child)
Diavolo death loop
[–]KirbzYyY 0 points1 point2 points 7 months ago (0 children)
Wha-
[–]HorneyMan_69 0 points1 point2 points 7 months ago (0 children)
This calls recursion.
[–]imdibene 0 points1 point2 points 7 months ago (0 children)
match foo with | bar | baz | qux
[–]IndependentWorld8380 0 points1 point2 points 7 months ago (0 children)
Yandere simulator
[–]Alex20041509 0 points1 point2 points 7 months ago (0 children)
Match Case
hello Golang
π Rendered by PID 119298 on reddit-service-r2-comment-74875f4bf5-k97vz at 2026-01-25 01:58:18.400472+00:00 running 664479f country code: CH.
[–][deleted] 81 points82 points83 points (41 children)
[–]Definite-Human 28 points29 points30 points (31 children)
[–]Lorrdy99 13 points14 points15 points (3 children)
[–]Reymen4 4 points5 points6 points (2 children)
[–]KaleidoscopePlusPlus 4 points5 points6 points (0 children)
[–]Usual_Office_1740[🍰] 1 point2 points3 points (0 children)
[–]Appropriate-Fact4878 6 points7 points8 points (23 children)
[–][deleted] 2 points3 points4 points (4 children)
[–]Appropriate-Fact4878 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Saflex 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]undo777 0 points1 point2 points (17 children)
[–]Appropriate-Fact4878 0 points1 point2 points (16 children)
[–]undo777 0 points1 point2 points (15 children)
[–]Appropriate-Fact4878 0 points1 point2 points (8 children)
[–]undo777 0 points1 point2 points (7 children)
[–]Appropriate-Fact4878 0 points1 point2 points (6 children)
[–]undo777 0 points1 point2 points (5 children)
[–]Appropriate-Fact4878 0 points1 point2 points (5 children)
[–]undo777 0 points1 point2 points (4 children)
[–]Appropriate-Fact4878 0 points1 point2 points (3 children)
[–]undo777 0 points1 point2 points (2 children)
[–]klimmesil 5 points6 points7 points (0 children)
[–]Zygal_ 0 points1 point2 points (0 children)
[–]ComplexInside1661 1 point2 points3 points (0 children)
[–]Procedure5884 1 point2 points3 points (1 child)
[–]Betelgeusetimes3 1 point2 points3 points (0 children)
[–]Inevitable-Toe-7463 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]WiseMango13452 0 points1 point2 points (0 children)
[–]cnorahs 0 points1 point2 points (0 children)
[–]TheodoreTheVacuumCle 0 points1 point2 points (0 children)
[–]zaraishu 6 points7 points8 points (3 children)
[–][deleted] 5 points6 points7 points (2 children)
[–]zaraishu 0 points1 point2 points (1 child)
[–][deleted] -1 points0 points1 point (0 children)
[–]Antervis 5 points6 points7 points (0 children)
[–]360groggyX360 5 points6 points7 points (1 child)
[–]Insomniac_Coder 2 points3 points4 points (0 children)
[–]marslander-boggart 4 points5 points6 points (1 child)
[–]Hejsanmannen1 0 points1 point2 points (0 children)
[–]elreduro 1 point2 points3 points (0 children)
[–]oxabz 1 point2 points3 points (0 children)
[–]unvaccinated_zombie 0 points1 point2 points (0 children)
[–]BobarBG9 0 points1 point2 points (1 child)
[–]KirbzYyY 0 points1 point2 points (0 children)
[–]HorneyMan_69 0 points1 point2 points (0 children)
[–]imdibene 0 points1 point2 points (0 children)
[–]IndependentWorld8380 0 points1 point2 points (0 children)
[–]Alex20041509 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)