r/ProgrammerHumor • u/[deleted] • Oct 14 '22
Meme “So how’s your computer science class going so far?”
6.2k
u/sarc-tastic Oct 14 '22
23 seconds!!!
3.4k
Oct 14 '22
I know, it’s so efficient!
2.4k
u/NicNoletree Oct 14 '22
I'm more concerned that it took you 23 seconds to enter two single digit numbers.
2.4k
→ More replies (6)145
Oct 14 '22
I was thinking the timer didn't start until after the input was received, and before the heavy computational section.
→ More replies (33)37
u/CuriousPincushion Oct 14 '22
I really want to see this code. timeout 23000 or what?
→ More replies (3)45
→ More replies (2)9
292
u/Darkpoulay Oct 14 '22
I'm picturing a neanderthal staring blankly at a sheet with two numbers after being asked if they're the same, and after 23 seconds of complete silence : "YUP"
71
u/oobey Oct 14 '22
"Corporate needs you to find the difference between this number and this number."
→ More replies (2)→ More replies (2)19
529
u/alexein777 Oct 14 '22
Source code:
...
print('Program took 23 seconds to execute')
→ More replies (8)332
Oct 14 '22
more like:
print($"Program took {firstNumber}{secondNnumber} seconds to execute");
→ More replies (2)182
u/bwaredapenguin Oct 14 '22
Bold of you to assume OP knows about string interpolation
→ More replies (3)30
u/de_Mike_333 Oct 14 '22
Ssssh, this way they can sell performance increasing updates later down the line.
48
11
u/spacemoses Oct 14 '22
The program is using a primordial ML model that is trying to determine universal axioms to describe equality, give it some time it'll get there.
8
→ More replies (8)6
2.2k
u/other_usernames_gone Oct 14 '22 edited Oct 14 '22
I'm going to guess you accidentally used = instead of ==.
= Is assignment, == is comparison.
1.7k
Oct 14 '22
To the surprise of everyone on the original it wasn’t that, I have done that before though. It was hours ago now this happened, it was something to do with code being outside of curly braces for an if statement
2.0k
u/dotcomslashwhatever Oct 14 '22 edited Oct 14 '22
I mean 2 and 3 are pretty close. in the grand scheme of things and the universe and spacetime, they are equal
919
→ More replies (34)64
u/IanFeelKeepinItReel Oct 14 '22
There's only two difficult problems in computer science:
Memory management.
Threading.
Off by 1 errors.
→ More replies (16)2
11
u/LemonLimeAlltheTime Oct 14 '22
those curly things are just for show. just fancy stuff.
you did it right.
→ More replies (1)→ More replies (17)31
u/Dubacik Oct 14 '22
if (a != b) { return false; } return true;I can see something llike this happening
→ More replies (2)17
u/xthexder Oct 14 '22
Except that would work fine. And somehow the issue didn't cause it to print both same/not same, which you might expect based on OPs comment about braces.
→ More replies (3)→ More replies (53)3
u/ThreatLevelBertie Oct 14 '22
Wrong. The code actually alters the fundamental laws of the universe and causes the two numbers to become equal to one another. It really should not have been pushed straight to a production universe, its cauding quite the headache
44
u/Limmmao Oct 14 '22
Did you delete the previous post and replaced it with this one? I think last time it took 6 seconds, so might be worth getting back to debugging.
44
Oct 14 '22
The time includes the time to input, if I set the numbers with no user input it takes around half a second
0
Oct 14 '22
[deleted]
→ More replies (1)37
u/HealingWithNature Oct 14 '22 edited Oct 14 '22
Everyone has asked to post the code and I really wanna see it 😭 but he won't
A If I read his comments right he's made the claim that the error was due to extra braces and an if statement but also a different claim that it wasn't due to an if statement, so I'm not sure he knows what's up lol
→ More replies (1)
9
5
u/sesor33 Oct 14 '22
OP is trolling you all hard and you're all falling for it. They won't post the code because they purposely made it bad. There's literally no possible way you could screw up something so simple without trying
8
Oct 14 '22
It was a compsci lab in which I had to modify given code to fit the problem, which was to see if two numbers are the same. Because of the modification I couldn’t just do a simple if statement.
→ More replies (2)
9.9k
u/YellowOnline Oct 14 '22
Well, exit code is 0, that's all that matters
2.8k
u/Alfsh Oct 14 '22
Honestly that's the first thing I saw and went "welp this looks fine".
→ More replies (55)643
u/SillyFlyGuy Oct 14 '22
If it compiles, ship it. Now it's a problem for QA.
You'll get credit for hitting product deadline today, then more credit for fixing the bug report tomorrow.
323
u/anonymousperson767 Oct 14 '22
This is actual true. You learn quickly there’s less reward for doing something well up front vs. being the hero putting out the fires you started.
→ More replies (15)121
Oct 14 '22
As a QA Engineer this comment triggers me because of how accurate it is 😂
→ More replies (2)→ More replies (6)27
501
u/grandcoriander Oct 14 '22
You'd fit right into our SRE team!
246
u/Henriquelj Oct 14 '22
No kidding that I worked at a company that required a minimum code coverage by testing, and everyone only wrote tests that would always succeed.
435
u/fukalufaluckagus Oct 14 '22
Roses are red. My code is a weirdo. I say true is false. Exit code 0.
→ More replies (11)40
59
→ More replies (3)26
u/Hrtzy Oct 14 '22
Nothing produces value for the customer like testing your getters and setters, am I right?
99
36
→ More replies (2)27
u/lupinegrey Oct 14 '22
The deployment workflow shows a green checkmark, so the deployment must have been successful.
No need to validate.
→ More replies (1)111
143
u/user0N65N Oct 14 '22
I know you jest, but Jesus fuck, no. I once tried to update a critical function in a healthcare diagnostic machine’s source to return and check for an error code, because it hadn’t since it was initially built and there was no way to know if the function was ever actually successful, and my immediate manager told me to put it back the way it was because it was “working” as is. On a healthcare diagnostics machine. 🤯 No, the company wasn’t Theranos.
136
u/GloriousNewt Oct 14 '22
programming has to be one of the least "industry standard" kinda professions out there while seeming somewhat organized to an outside observer.
I've seen, and written, some suspect code that makes it live.
Like if houses were built how software is written you could push them over with a stiff breeze.
131
u/stabamole Oct 14 '22
Nah if houses were built like software the breeze would destroy half of the house while the rest of it is so immovably durable it could survive an F5 tornado with no damage
→ More replies (14)→ More replies (9)20
u/anomalousBits Oct 14 '22
Weinberg’s Law (1975!)
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
→ More replies (1)→ More replies (2)5
u/zomiaen Oct 14 '22
Probably because your change would've required the device as a whole to go through certification again which is extremely expensive.
→ More replies (2)→ More replies (23)9
2.7k
u/LookyRo Oct 14 '22
sleep(23);
return x === x;1.5k
u/LookyRo Oct 14 '22
If anyone asks you to optimize your code, spend 2-3 days changing `sleep(23)` to `sleep(15)`.
666
118
u/boringdude00 Oct 14 '22 edited Oct 14 '22
I had a basic programming class in college ages ago. I'm the only halfway competant student in the class. Half of them can't figure out how to use a keyboard. I don't remember exactly what the final was, but it was something trivially, laughably easy so I wrote the code in like 10 minutes. And it wouldn't work. So I wrote it again. And it still wouldn't work. For a whole fucking two hours I wrote and rewrote that bastard. It wouldn't give me the right fucking answer. Even the dumb students are finishing up by this point and I'm running out of time. Finally I give up and having seen that the professor isn't checking shit, he's entering the exact same query and if your code returns the
correctsingle answer he's expecting you get a A, I improvise. So I just delete everything, write a simple one line that always returns the same answer and 1 minute later I' out the door with a A. I like to think I would have passed in spirit, even had he seen the "code".→ More replies (1)16
u/Tippity2 Oct 14 '22
Yes, I concur. Sometimes the purpose of the code is so stupid that you just make it work. But unless you have complete control over the code and can destroy it, someone will come along and build on your purposely crappy code.
8
u/Sky-is-here Oct 14 '22
Depending on the job i know at least a few friends that got away with this (small companies where they were the only ones really coding, so none could check their code lmao
→ More replies (2)5
26
u/VonNeumannsProbe Oct 14 '22
Shouldn't it be sleep (23000)?
→ More replies (5)19
u/Thebombuknow Oct 14 '22
Depends on the language. Python's time.sleep() is in seconds, same as it's asyncio.sleep().
3
→ More replies (7)3
u/RFC793 Oct 15 '22
The program has 2 interactive prompts though. Could be it takes the guy 11.5 seconds, on average, to enter each value.
353
u/the-brightknight Oct 14 '22
They're the same type, number, so technically correct right?
217
2
u/doihaveto9 Oct 14 '22
Did you use 1 or 2 '=' signs?
1
Oct 14 '22
Two, it was an extra if statement and misplaced curly brace that left some lines to be read when they weren’t meant to be.
2
2
2
u/Spaciax Nov 05 '22
23 seconds? did you do this calculation on a pregnancy test?
1
Nov 05 '22
No, that’s where I run doom. I ran this on a breadboard of electrical components that was assembled via random orientations of components by a monkey until one ran the code correctly.
385
u/thekrock23 Oct 14 '22
It takes a rare talent to code something that compares two numbers and takes 23 seconds to get the wrong answer.
116
u/niederaussem Oct 14 '22
The 23 seconds were probably the program waiting for user input.
→ More replies (1)70
→ More replies (1)5
u/SurfingASongWave Oct 14 '22
This reminds me of one of the stories in "The Cyberiad". Did the computer chase you down the street when you tried to argue with it?
60
97
40
107
u/aegookja Oct 14 '22
23 seconds? Are you doing ML?
→ More replies (4)24
21
3
u/KattyPyr0Style Oct 14 '22
LMAO How do you screw that one up?
check If num x == num y. If true, return yes, they are equivalent. Else, they're not. It's a single If statement lmfao
1
20
50
u/0x564A00 Oct 14 '22 edited Oct 14 '22
import ctypes
ctypes.c_int.from_address(
id(2)
+ ctypes.sizeof(ctypes.c_size_t)
+ ctypes.sizeof(ctypes.c_voidp)
).value = 3
print(2 == 3)31
→ More replies (1)3
u/theillini19 Oct 14 '22
Someone explain pls
10
u/0x564A00 Oct 14 '22
This is Python, specifically CPython (the standart implementation of Python). Python treats everything as objects, even integers, because it loves being inefficient. To recoup a bit of efficiency, it interns integers from -5 to 256, meaning there is a single object representing each of them.
This code takes the address of the object representing the integer 2, skips the object header and uses pythons FFI to overwrite its value with the integer 3.→ More replies (1)
15
u/GaryTheSoulReaper Oct 14 '22
How did you do on “Hello World!”?
→ More replies (1)33
u/Astramancer_ Oct 14 '22
Hel
Segmentation fault (core dumped)
11
u/JohnLocksTheKey Oct 14 '22
It takes real skill to get a segmentation fault with Python…
→ More replies (2)
13
13
u/Eagle240sx Oct 14 '22
I don't know what's funnier, the answer, the time that took ti finish or the code
→ More replies (2)
11
u/DJ-WS Oct 14 '22
change “are the same number” into “are both numbers”. then it probably will be 0.00001 second…
9
u/palordrolap Oct 14 '22
x+1e17 == y + 1e17?
Probably not, but things like this catch programmers out every so often.
9
u/st-shenanigans Oct 14 '22
Welcome to the party, as another programming student, let me know how you feel in a year or two when you're simultaneously at peak confidence in your coding skills while the impostor syndrome is also hitting just as hard cause you tried to do one thing outside of class and realized you don't know anything.
.. May or may not be related to current events
8
u/kazenorin Oct 14 '22
if (num1==num2) printf("%d and %d are not the same number", num1, num2)else printf("%d and %d are the same number", num1, num2)
→ More replies (1)19
u/thatOneGuyWhoAlways Oct 14 '22
Printf("%d and %d are %s the same number, num1, num2, (num1==num2) ? "":"not")
→ More replies (1)7
7
7
6
Oct 14 '22
It compiled, it executed, it exited with code 0. That's above average for a lot of cs students.
2
u/Dr739ake Oct 14 '22
why 2=3? i mean 0010 != 0011 in binary so why? also what language is it written in? Im curious.
7
Oct 14 '22
C++, it was a misplaced curly brace and an extra if statement in my code that did it.
→ More replies (1)
5
5
Oct 14 '22
I think you’ll need to retrain your neural network. Seems like the training data was created by a 2 year old.
5
4
4
4
Oct 14 '22
I took FORTRAN as my computer programming course in college (mechanical engineering major).
For our final project we were required to code some type of game. Pretty sure I chose Battleship. Anyway, I am a terrible programmer, and as the deadline approached I couldn't get my game to work as intended.
So, the "game" I turned in for the assignment basically just printed the board a certain number of times and then said "you win".
1
1
u/Negative-Demand350 Oct 14 '22
Bruh, this is legitimately hilarious because a part of me knows that there is no function being used. You're comparing every number to every other number using if statements, aren't you?
def shit_tier_function_w_shit_tier_name(x,y):
if x == y:
print("same same")
else:
print("no same same")You'd use formatting w/ print to adjust the print statements to your assignment's specifications.
---------------------------------------------------------------------------------------
(Probably banned by the time you read this comment - banned from entire internet basically, autobanned when I create and post)
#JusticeForThePermaBanned
1
Oct 14 '22
It was a comp sci class lab, so they inject a bunch of random unnecessary items into the code to give you practice even if it’s unnecessary.
→ More replies (6)
1
u/Unexpected_Cranberry Oct 14 '22
Am I the only one that instantly wanted to put apple and pear as inputs to see what would happen?
1
Oct 14 '22
They’re integer inputs so it would just come back as 0 and 0, though if I changed them to string they would output “apple and pear are the same number”
1
u/Slight-Eye7588 Oct 14 '22
23 seconds 🤣🤣🤣
2
Oct 14 '22
It includes the user input, took me 22.50 seconds to enter the two numbers (I haven’t slept in two days)
→ More replies (1)
1
u/RoboErectus Oct 14 '22
If you get started with TDD now and it's going to make the rest of your career ridiculously easier.
The purpose of computer science is to discover new things.
The purpose of computer engineering is to be as fucking lazy as possible and get doom to run on anything.
With TDD you don't even have to run your code to know if it's working. The test framework runs it for you. Laziness++
2
1
u/CattMk2 Oct 14 '22
I can understand the comparison mistake, you mentioned in another comment there was an incorrect indent, but how did it take 23 seconds to do this?
1
Oct 14 '22
It was lines of code placed outside an if statement by accident, due to a copy paste error from another piece of my program. Said code was the output for the numbers being equal, followed by a return 0, which gave this result
As for the time, it took me 22.5 seconds to enter the numbers because I was distracted
1
Oct 14 '22
I barely know how to turn on my PC, and I can't quite understand how that conclusion was reached. Didn't the computer understand the proposition?
1
1
u/TheHandsomePo-ta-to Oct 14 '22
What I wanna know is how the fuck did that take 23 seconds to run? 😂
2
1
1
1
u/lifeson106 Oct 15 '22
Your program compiles and runs without crashing!?!? You're practically a wizard.
1
9
6
3
3
3
3
u/Caden_PearcSkii Oct 14 '22
I recently started learning python and I actually managed to solve this.
Heres the code I made in 5 minutes
print("Type two numbers to test if they're the same")
firstNumber = input("Number 1: ")
secondNumber = input("Number 2: ")
if firstNumber != secondNumber:
print(f"{firstNumber} and {secondNumber} are not the same.")
else:
print(f"{firstNumber} and {secondNumber} are the same.")
This makes me feel like a god, it may seem like some noob things to you guys but god damn does this make me feel accomplished.
2
2
u/cs-brydev Oct 14 '22
Some of your classmates on Reddit right now:
"I just finished the first week of a Computer Science class and haven't even created a simple FPS yet!"
→ More replies (4)
2
2
u/Wise_Kitchen4109 Oct 14 '22
== not =
I'm guessing you used an assignment operator in your comparison. 😅
2
2
2
2
2
2
2
2
2
2
2
2
Oct 14 '22
Press any key to continue . . .
Presses Escape
Your input was invalid, continuing with the execution . . .
2
2
2
2
u/G66GNeco Oct 14 '22
Just say you intended the program to work for astrophysics, so it's basically correct.
2
2
2
2
u/dead2fast2 Oct 14 '22
How the hell did you get that to take that long (assuming there are no delays in the code). Kinda impressed how bad it is
→ More replies (1)
2
u/smooth_criminal1990 Oct 14 '22 edited Oct 14 '22
If this is C or a similar language that doesn't hold your hand, I'd be willing to bet that the programmer used = instead of == in their if statement!
Isn't it great when the compiler does what you tell it to? Isn't it?
Edit: just saw OP's comment saying it wasn't this. Bravo and best of luck in your future endeavours!
2
u/CraigTheIrishman Oct 14 '22
Your apostrophe is missing. I think the computer mistook it for a 1 and added it to the first value before the comparison. You're welcome.
2
u/StoopidIdietMoran Oct 14 '22
If it makes you feel any better, I was definitely the worst at programming of all my peers in college, I managed to graduate thanks to chegg and memorizing what I needed to know for exams. I couldn’t write a single line of code without googling it once I was done with school. 5 years later, I’m a Senior Dev/Product Owner at a very well known company.
2
u/MagicNachti Oct 14 '22
Something tells me that you are accidentally checking for data type. Something also tells me that I am completely wrong.
2
Oct 15 '22
That's why I dropped out. Classes were absolutely useless. Half my professors were never even software engineers. Most of them were accountants for some reason
The only one in college that was great was on mysql, but I found I learned more in highschool than I ever did at my university
Obviously it varies from school to school though
2
2
2


761
u/[deleted] Oct 14 '22
Reupload that doesn’t give away my full name, plus cleaner screenshot.
My error was something to do with misplaced curly braces and an if statement, I couldn’t recreate it exactly as it was.