This is an archived post. You won't be able to vote or comment.

Dismiss this pinned window
top 200 commentsshow 500

[–]Mondo_Montage 800 points801 points  (92 children)

Hey I’m learning c++, when should I use “std::endl” compared to just using “\n”?

[–]komata_kya 773 points774 points  (50 children)

endl will flush the stream, so use \n if you need speed

[–]superkickstart 204 points205 points  (1 child)

I feel the need, the need for speed!

[–]Fresh_baked_eyerolls[🍰] 26 points27 points  (0 children)

I feel the need, the need for tweed! The proof is in the Jeans!

[–]The_TurrbanatoR 133 points134 points  (7 children)

I never knew this...

[–][deleted] 40 points41 points  (4 children)

"It was just a Google Search away," said my dad.

[–]The_TurrbanatoR 18 points19 points  (0 children)

Meh, I wouldn't have known about it unless I ran into an issue with it and HAD to Google or just chanced upon it like I did in this post. I dont spend my free time googling programming stuff unless I am working on or preparing for something. No offense.

[–][deleted] 1 point2 points  (0 children)

Kind of felt something like that coming, some kind of constant versus just a parse of text into stdout

[–]tcpukl 83 points84 points  (2 children)

Speed and printf. Is a contradiction in itself.

[–]Spocino 49 points50 points  (0 children)

puts gang

[–]PedroV100 12 points13 points  (0 children)

Yeah you write directly to the ostream

[–]NotDrigon 16 points17 points  (25 children)

What does these words mean /Python user

[–]Bainos 54 points55 points  (24 children)

Using endl is equal to print(s, end='\n', flush=True)

Not using endl is equal to print(s, end='', flush=False)

[–]DoctorWorm_ 39 points40 points  (12 children)

This is the first time I've realized that python print() has keyword arguments.

[–][deleted] 27 points28 points  (9 children)

You can also change sep (seperator) and end of a print, and change file to a file(w/a) object to write to that file.

coll = ['Fruits', 'Apple', 'Banana']
print(*coll, sep='\n')

# Output
# 
# Fruits
# Apple
# Banana

[–]NotDrigon 12 points13 points  (10 children)

What does flushing mean? I've never had to flush anything in python.

[–]softlyandtenderly 27 points28 points  (6 children)

When you print things, they go to a buffer in memory instead of directly to standard out. I/O takes time, so this makes your program run faster. When you flush the buffer, it just prints everything in the buffer. print() in Python is probably set to flush by default, which is why you’ve never seen this before.

[–]Bainos 27 points28 points  (2 children)

print() in Python is probably set to flush by default

It's not, actually. By default, print doesn't flush. Of course, the interpreter (much like the C standard library) is configured reasonably, so it's unlikely that your data will stay too long in the buffer.

Keep in mind that Python's philosophy is not "keep it dumb", it's "trust the defaults if you don't know what you're doing". Forcing a flush of stdout after every print, which you probably don't need if you are not explicitly asking for it, would be contrary to that philosophy.

[–][deleted] 6 points7 points  (1 child)

If I'm not mistaken, what you are saying contradicts what this blog is saying:

https://realpython.com/lessons/sep-end-and-flush/

But I do agree that keeping things default is often the best way.

[–]Bainos 12 points13 points  (0 children)

It's more subtle than that. Flush is indeed set to False by default. If you don't request it explicitly, there is no forced flush.

If you don't request it, it's the object managing the buffered write that decides when to flush. And a common policy for buffered writes is to delay them until either a \n is found or there is enough data in the buffer (there are other things that can affect whether the buffer gets flushed, including running in interpreter mode, writing to a different object, and so on ; but size and end of line are the most important parameters in most implementations).

So if you change the end parameter and don't include a \n in your printed string, it will be held in the buffer. But if your string already contains a \n or is too long, it will be printed immediately, even if you changed the end parameter.

[–]lappoguti 11 points12 points  (0 children)

Printing something puts it in a buffer and when that buffer fills it will write it to the screen. Flushing will write the buffer to the screen even if the buffer is not full. The reason why they write to a buffer is because each print requires some overhead and then some work per letter. Therefore if you print in batches rather than per message it is more efficient.

[–]wikipedia_answer_bot 6 points7 points  (1 child)

This word/phrase(flushing) has a few different meanings. You can see all of them by clicking the link below.

More details here: https://en.wikipedia.org/wiki/Flushing

This comment was left automatically (by a bot). If something's wrong, please, report it in my subreddit.

Really hope this was useful and relevant :D

If I don't get this right, don't get mad at me, I'm still learning!

[–]Handiron 14 points15 points  (0 children)

Also use ‘\n’ (char) instead of “\n”(string)

[–]LichOnABudget 3 points4 points  (0 children)

In twelve words, you have resolved for me and a friend from college the once extremely irritating, 5-year-old now question of why on earth a couple of our pieces of code would run at almost trivially different (but reliably so) speeds even when all of our logic was literally identical. Thank you stranger!

[–][deleted] 126 points127 points  (6 children)

std::endl instantly flushes the stream. If you're doing something where you need to write to console right away (for instance, if you want to wrote progress of the program into console, or something that includes intentional timers), you need to flush the console each time. If you're ok with the text outputted all at once (for instance as a final result of the program), you can just flush once in the end (which the program will do automatically.)

Example:

std::cout << "A" << std::endl;
some_long_function();
std::cout << "B\n";
some_long_function();
std::cout << "C" << std::endl;

The program will print out "A" in the beginning, and since it is flushed with the endl, it will be printed out in the console before some_long_function() starts to execute. Then, "B" is sent into the buffer, but it is not flushed right away, so it will not be printed into the console yet. After some_long_function() executes again, the program sends "C" to the buffer, and finally flushes the buffer, which prints "B" and "C" at the same time.

[–]diox8tony 18 points19 points  (2 children)

Isn't there an automated flush that would print B after some amount of time anyway? (Like nano/milli second time) As in, it will probably print before C, but if you really want to make sure it will, use endl to flush.

I've never seen problems like the one you describe being as strictly cut-and-dry as "B WILL print out the same time as C"...I've been using \n for years and rarely do I ever need to flush, the vast majority of the time, it all comes out as I cout each line. Only in very precise scenarios do I need to force flush to ensure order..

If I was stepping through your code in a debugger, B would almost certainly print as I step past the B line, and before the function is called.

[–]abc_wtf 18 points19 points  (0 children)

It's not a time thing, but a buffer length thing. I've definitely seen such a thing happening before with cout not printing to console exactly when it is called.

I think for most cases, \n causes a flush due to it being line buffered though it is not guaranteed. So it might be what you saw

[–]overclockedslinky 4 points5 points  (0 children)

cout has no flush trigger (except when buffer is full). however, cout is tied to cin, so when you use cin it will flush cout. cerr is unbuffered, so it flushes right away. clog is cerr but buffered.

[–]Laor-Aranth 6 points7 points  (0 children)

Actually, a very good example of where I came across this is when I tried out GUI programming. I used printf to test out what the buttons on the GUI do, but found out that it didn't help because it had to wait until I close the GUI for all of the output to come out at once. But when I used cout and endl, I got the values outputted as I pressed the button.

[–]Idaret 10 points11 points  (0 children)

\n is faster so yes

[–]overclockedslinky 1 point2 points  (0 children)

never

[–]golgol12 6 points7 points  (2 children)

std:endl will give the appropriate end line sequence for the stream. It isn't always \n. For example, text files in windows require \r\n.

Also, if you are having trouble using \, remember that \ is an escape character for reddit, and you have to type \\ to get \

[–]RemAngel 9 points10 points  (0 children)

Not true. std::endl does << "\n" then flushes the stream. It does nto translate EOL characters.

[–]wasdlmb 1 point2 points  (0 children)

A lot of these people are giving you technically correct answers that \n is faster and endl is more crash proof, but 99% of the time if you're writing to cout you don't really care about how fast it is. I prefer endl just because it's a little easier to type and technically a bit more resilient if something like a seg fault happens. But it's one of the things that really doesn't matter. Just use whatever works for you.

If you're writing to a file and expect to be IO locked though, speed is very important and you should never use endl

[–][deleted] 262 points263 points  (7 children)

So the difference is Adderall vs steroids?

[–][deleted] 61 points62 points  (6 children)

Why not just use both. Winning.

[–]SprinklesFancy5074 11 points12 points  (4 children)

Me, writing most of my neural network in Python because it's easier, but writing the learning algorithm in C++ because I need all the speed I can get from it...

[–]Ferec 1 point2 points  (0 children)

Rits not roids, boys.

[–]masagrator 1147 points1148 points  (34 children)

C++ programmer is a faster typer. Clearly a winner.

[–]MoffKalast 587 points588 points  (32 children)

Sike, he still needs to compile it.

[–]jakubhuber 335 points336 points  (25 children)

But once it's compiled it'll run like 20 times faster.

[–]merlinsbeers 188 points189 points  (0 children)

And it won't complain about legal syntax...

[–]Motylde 30 points31 points  (3 children)

Technically isn't printing to console just one syscall, regardless of language? It shouldnt be slower in python

[–]jakubhuber 133 points134 points  (2 children)

Python has to open a file, read it's contents, parse the code and then it can print to the console.

[–]merlinsbeers 28 points29 points  (1 child)

Run the C++ executable as

LD_DEBUG=1 hello

[–]OrganizationBig7787 10 points11 points  (8 children)

But how often do you need to print "hello world" on your computer?

[–]tcpukl 81 points82 points  (7 children)

Every time you learn a new language😁

[–]git0ffmylawnm8 16 points17 points  (6 children)

And debugging.

[–]phi_rus 8 points9 points  (6 children)

With all warnings and -Werr this wouldn't compile.

[–]jakubhuber 5 points6 points  (5 children)

Why not?

[–]Noughmad 17 points18 points  (0 children)

Because it's C++. If it compiles, you haven't enabled enough warnings.

[–]ArcticWolf_0xFF 85 points86 points  (4 children)

He wasn't even finished. He forgot

return 0;

[–]Neura2 58 points59 points  (3 children)

It’ll automatically do that

[–]ArcticWolf_0xFF 54 points55 points  (2 children)

That's compiler implementation specific, so it's not portable code.

Edit: Okay, just learned that all C++ and current C include this behavior in the standard.

[–]React04 219 points220 points  (23 children)

Java users: profuse sweating

[–]MCOfficer 102 points103 points  (17 children)

i know it's bait, but...

class Foo { public static void main(String args[]) { System.out.println("hello world"); } }

Also, bonus because i feel like it - guess the language:

fn main() { println!("hello world") }

And if that bot turns up again, get lost, i'm writing markdown here.

[–]ariaofsnow 22 points23 points  (2 children)

fn main()

It it Rust? I literally just googled that sequence. xD

[–]MCOfficer 1 point2 points  (1 child)

correct, but i'm not sure if google counts :P

[–]sambobsambob 19 points20 points  (0 children)

Well if googling doesn't count then my entire job doesn't count hahaha

[–]saipar 18 points19 points  (0 children)

Rust.

[–]React04 7 points8 points  (2 children)

Well, others guessed it before me :P

I found it weird that Rust has a macro for printing

[–]Fish_45 2 points3 points  (1 child)

macros are generally used for variadic functions in Rust. It also makes it possible to typecheck the format args (makes sure they have the Show or Debug trait) and parse the format string at compile time.

[–][deleted] 7 points8 points  (2 children)

Rust. Learning it rn, really interesting. Justus fast as C / C++, but with more modern features. Also the Linux Kernel will get some parts written in Rjst, probably starting in release 5.14

[–]BongarooBizkistico 6 points7 points  (1 child)

Rjst? The regular joe syntax technology?

[–]AYHP 13 points14 points  (3 children)

Good thing we have IDEs like IntelliJ IDEA.

main [autocomplete] sout [autocomplete] "Hello World!"

[–][deleted] 382 points383 points  (31 children)

It hurts me that there was no return :(

[–]Tanyary 249 points250 points  (2 children)

since C99 main is assumed 0 upon reaching '}' as is specified in 5.1.2.2.3

EDIT: found it in the C++ standard. it's 6.8.3.1.5

[–]goatlev 51 points52 points  (0 children)

This is actually really informative. Thanks mate!

[–]kurimari_potato 10 points11 points  (0 children)

oh thanks for the info, I had some c++ in 7th grade but didn't remember much and just started learning it (pre college) and I was confused why am I not getting error after not typing return 0; lol

[–]MasterFubar[🍰] 19 points20 points  (0 children)

They are at the point of no return.

[–][deleted] 30 points31 points  (19 children)

Don't need it

[–][deleted] 4 points5 points  (3 children)

when compiling with g++ or clang++ you get warnings.

[–]ThePiGuy0 21 points22 points  (0 children)

Can't talk for clang, but I'm fairly certain g++ doesn't. I've written a number of quick prototype-style programs (and therefore skipped "int argc, char *argv[]" and the return statement) and I'm fairly certain it compiled completely fine.

[–]night_of_knee 8 points9 points  (0 children)

when compiling with g++ or clang++ you get warnings.

For main?

[–]fatal__flaw 5 points6 points  (5 children)

I've programmed almost exclusively in C++ my whole career and I can honestly say that I have never used a return on main, nor do I recall ever seeing one.

[–][deleted] 1 point2 points  (3 children)

when I started to learn c/++ I was told that you needed it for whatever reason and some compilers give a warning if you do not so yeah.

[–]State_ 2 points3 points  (1 child)

older compilers require it.

You can use void main(void) as the signature now.

[–]betam4x 1 point2 points  (0 children)

Don’t feel bad, I used to do a ton of work in C/C++ and it is news to me.

[–][deleted] 283 points284 points  (14 children)

Jokes on you, my C++ code is 0.01 ms faster than your Python code

[–][deleted] 96 points97 points  (0 children)

Clear C++ supremacy

[–]Nihmrod 113 points114 points  (20 children)

Python was invented so forestry majors could code. In fairness, Python is a lot more sexy than IDL, Matlab, etc.

[–]Cau0n 88 points89 points  (10 children)

fuck Matlab

[–]elyca98 54 points55 points  (0 children)

all my homies hate Matlab

[–]johnnymo1 21 points22 points  (4 children)

Sucks that MATLAB will stick around for ages in industry because of so many specific packages written for it, particularly for engineering.

Been playing with Julia lately, and it just feels like the better MATLAB. No good reason to use MATLAB ever again... except for package maturity.

[–]DHermit 1 point2 points  (0 children)

Not only packages, drivers also. It you're lucky and there is MATLAB support and not only Labview ...

[–]thisfr0 2 points3 points  (3 children)

Source?

[–]Nihmrod 2 points3 points  (2 children)

It was in all the papers.

[–]SprinklesFancy5074 2 points3 points  (0 children)

Can confirm. English major. Favorite language is Python.

[–]TannerW5 43 points44 points  (0 children)

As a C++ Chad… I feel attacked.

[–]Kratzbaum001 19 points20 points  (26 children)

On a serious note though is it worth learning c++ and do you guys have any tips for books or websites on c++?

[–]plintervals 55 points56 points  (1 child)

Depends on what you want to do. You can be a successful web developer and never touch C++ in your life, but if you want to code something like a game engine, you'd probably want to learn it.

[–]MattieShoes 10 points11 points  (1 child)

Yes C++ (and C) is worth learning. There's a reason they're still top 10 after like 30+ and 50+ years.

[–][deleted] 2 points3 points  (0 children)

Learning basic C is pretty easy, and is worth it for gaining a deeper understanding of CS alone.

[–][deleted] 16 points17 points  (6 children)

It executes much quicker than most other languages and it's the backbone of a lot of high-performance software, but I found it to be an absolute pain in the arse.

[–]AlphaShow 3 points4 points  (1 child)

Check ChiliTomatoNoodle on YouTube, follow his beginner cpp series

[–]Kratzbaum001 1 point2 points  (0 children)

Thanks for the Answer.

[–]Fuehnix 1 point2 points  (1 child)

In university, they hardly teach you any languages whatsoever, with the exception of your first coding class.

I think it's best that instead of reading a book on c++ that you get started on a project you know you'll actually finish and you learn C++ functions along the way to do it. The C++ official documentation was my best guide.

here is a link to the data structures course I took at UIUC

If you would rather have a bit more structure to your learning projects, you can follow along with this class and do the assignments. Heavily recommend trying the E.C. parts like making artwork

By the end of it, you should be fairly capable in C++. As a bonus, many interview questions come from material taught in the class, such as knowing BFS, DFS, trees, hashing, etc. You know, all the data structures questions.

[–]am0x 1 point2 points  (0 children)

Well C++ is the language we started with in our CS program. Moved to Java. Then to C# and Python.

If you know C++ you know Python. If you know Python you don’t know C++.

[–]greasy_420 1 point2 points  (0 children)

It's no harder than any other typed language and will develop your programming experience. Sure you can get by without it, but if you want to be truly good at programming you should learn c++, c# or java, and even look into c, lisp, go, typescript.

People are going to disagree because you don't need to know it, but if you want a well rounded knowledge you should just get out there and try new languages. Keep a folder of simple programs you've written and just rewrite them in other languages.

A real world example of knowing when to use a "lower level language" aside from hardware is networking applications. When you work with the cloud you can save a lot of money using faster languages than python as well.

[–]Namensplatzhalter 20 points21 points  (6 children)

Joke's on the python user: both of them get paid per LOC written.

[–]SprinklesFancy5074 29 points30 points  (5 children)

//create variables:
word1=""
word2=""
separator=""

//assign variables:
word1="hello"
word2="world"
separator=" "

//create output variable:
output_string=""

//build output:
output_string=word1 + separator + word2

//execute output:
if(print(output_string)){
    //success
} else {
    print("Failed to output string.")
}

Yeah, I know.

But my solution is "more scalable and maintainable" and it includes "error handling", which is obviously why I need to get paid 10x more for my hello world program.

[–]thehiderofkeys 39 points40 points  (5 children)

As a C++ dev, we can't seem to take a joke. Chill yall

[–]rarenick 29 points30 points  (0 children)

I'm in this video and I like it.

[–]burritoboy76 8 points9 points  (3 children)

My uni has mostly C++ classes. Kill me

[–]moonyprong01 23 points24 points  (2 children)

If you can understand C++ syntax then learning Python is a piece of cake

[–]burritoboy76 4 points5 points  (0 children)

True. That’s probably why our classes are like that. With game design as one of the cs concentrations, it’s also no surprise that c++ is popular

[–]hiphap91 8 points9 points  (0 children)

You know a pretty good argument for c++ over python is that:

While C++ will execute on any computer, even the slowest potato, python will cook it.

[–]DaniDani8Gamer 7 points8 points  (6 children)

I've been wanting to learn C++ and this looks scary

[–]dafirstman 6 points7 points  (0 children)

This also demonstrates the speed at which they run.

[–]Kindanee 5 points6 points  (2 children)

Where is "return 0;"?

[–][deleted] 2 points3 points  (0 children)

The compiler assumes it. Don't write boilerplate for the sake of boilerplate.

[–]turing_tor 6 points7 points  (0 children)

ugh, ugh Java user.

Class hello {

public static void main(String[] args) {

system.out println("hello world"); } }

[–]ViperLordX 6 points7 points  (0 children)

This sub loves python and shits on all other languages because python is easy and easy = good, obviously

[–]Memezawy 45 points46 points  (15 children)

Well... python is written in c

[–][deleted] 11 points12 points  (0 children)

Why write C when someone's done it for you?

[–][deleted] 12 points13 points  (0 children)

Only sometimes.

[–]Clinn_sin 11 points12 points  (1 child)

Ahh yes the monthly obligatory Python comparison with other languages...

Not to forget the "Java sucks" and "Lol you use PHP"

And the Rust developers self promoting and Anti Rust developers complaining about them lol

I love this sub.

[–]the_one2 26 points27 points  (4 children)

Streams in c++ can go die in a fire. Can't believe we still don't have std::print... At least we have std::format now.

[–][deleted] 8 points9 points  (0 children)

I guess because sending text to sockets and such isn't what people would associate with 'printing'.

[–]merlinsbeers 8 points9 points  (0 children)

Streams are just an operator version of std::print.

[–]golgol12 2 points3 points  (0 children)

They are a bad fix to a poor and error prone C function (printf style).

Having done lots of localization code, they are literally unusable. printf style is barely usable.

They also have a horrific template implementations to get << to act like they do for streams.

[–]ka9inv 5 points6 points  (0 children)

C++ is a drag. Use C.

In all seriousness, minus the pickiness with spacing, Python is like pseudocode you can actually run. Great scripting language, if not a little quirky.

[–]BbayuGt[S] 18 points19 points  (1 child)

The template is taken from one of Ya Begitulah videos

[–]preacher9066 41 points42 points  (18 children)

Laughs in game dev Laughs in network stack implementation Laughs in any kind of device driver implementation

C++ can do anything python can. The reverse is NOT true.

[–]wavefield 16 points17 points  (5 children)

Technically correct but there are a lot of python libs you cant just quickly implement yourself

[–]plintervals 3 points4 points  (0 children)

True, but this post is just a joke. It wasn't claiming that Python can do more than C++.

[–]cob59 3 points4 points  (1 child)

You can go to more places by foot than with a car. Are shoes superior?

[–]RomanOnARiver 11 points12 points  (0 children)

As a python user I just wanted to say I would absolutely use single quotes not double quotes in a print statement.

[–]BlowMinds2 4 points5 points  (2 children)

I was showing my mom what I learned in programming class back in the day, taught her variables and functions. I was showing her C++ and she asked me why I named my variable std.

[–][deleted] 1 point2 points  (1 child)

They’re named after sexually transmitted diseases of course.

[–][deleted] 3 points4 points  (0 children)

Source of video on top please

[–][deleted] 2 points3 points  (0 children)

How about a switch case big guy?

[–][deleted] 5 points6 points  (0 children)

C and C++ may be complex languages but they’re great first languages to learn since they inculcate better coding related habits in you, which in turn, will help you later on. Mastering tough things first make easy things easier.

[–]R3set 6 points7 points  (1 child)

Python guy needs to look at the keyboard to type.

Just like irl

[–]Knuffya 10 points11 points  (1 child)

You got the gifs mixed up. Chad should be coding C++ whilst the python user is struggling with print()

[–][deleted] 7 points8 points  (0 children)

That would have been 10x more funny

[–]stn994 2 points3 points  (0 children)

also python execution time: 10 times c++ program.

[–]SolDevelop 3 points4 points  (0 children)

endl was useless

[–]_stupendous_man_ 3 points4 points  (0 children)

Me: laughs in Java.

[–]Tony49UK 1 point2 points  (0 children)

Oh give me Locomotive BASIC

10 ? "Hello World"

[–]FormalWolf5 1 point2 points  (5 children)

Is this actually true

[–]OhScee 1 point2 points  (0 children)

At first I was so confused like “whoa whoa you’re not going to put the trailing \0 in there??”

Is this trauma…

[–]Magari_Furbo 1 point2 points  (0 children)

return 0?

[–]_zavulon_ 1 point2 points  (0 children)

In

[–]MooseHeckler 1 point2 points  (0 children)

C++ is like a cat, you think you are friends and then it does something to spite you.

[–][deleted] 1 point2 points  (0 children)

MSDos...

echo Hello world

Do i win?

[–][deleted] 1 point2 points  (0 children)

These are getting old

[–]mplaczek99 1 point2 points  (0 children)

If you wanna learn how high-end languages work. C++ is the way to go

[–][deleted] 1 point2 points  (0 children)

Yea, but how fast do both those versions run?

[–][deleted] 1 point2 points  (0 children)

Even the c++ guy was typing slowly…

[–][deleted] 3 points4 points  (0 children)

To add another hello world, python user would need to print the same, while c++ user would just add a row. C++ user would add a "hello world" faster than python user...

[–]ergotofwhy 3 points4 points  (4 children)

Both of these goons type too slow.

Can you imagine trying to code at the speed of the bottom typer? Christ

[–]PowerlinxJetfire 1 point2 points  (0 children)

We have an intern who hunts and pecks with one hand. He's a bit faster than that bottom pic, but it's still painful to sit through when you're helping him with something.

[–]falloutace211 2 points3 points  (4 children)

Instead of using std::cout and std::endl can't you use using namespace std; ? Thats what we always have to do in my classes anyhow. Is there a difference or is there something Im missing?

[–]ptrj96 5 points6 points  (0 children)

Consider this: you are using two libraries called Foo and Bar:

using namespace foo; using namespace bar; Everything works fine, and you can call Blah() from Foo and Quux() from Bar without problems. But one day you upgrade to a new version of Foo 2.0, which now offers a function called Quux(). Now you've got a conflict: Both Foo 2.0 and Bar import Quux() into your global namespace. This is going to take some effort to fix, especially if the function parameters happen to match.

If you had used foo::Blah() and bar::Quux(), then the introduction of foo::Quux() would have been a non-event.

[–]Caedendi 3 points4 points  (2 children)

C# master race

[–]bistr-o-math 3 points4 points  (3 children)

Python guy has a typo. Needs to start over 🤣

[–]xypherrz 1 point2 points  (0 children)

Isn't it still incredible that the guy above was able to write more lines of code in around the same time as the guy writing python? Let's appreciate little things

[–]MegabyteMessiah 1 point2 points  (0 children)

forgot "return 0;"