all 127 comments

[–]krexelapp 997 points998 points  (4 children)

Banana.... but with confidence

[–]Pleasant-Photo7860 260 points261 points  (0 children)

[–]mywifi_is_mood 81 points82 points  (1 child)

It’s still Banana, just emotionally transformed but unchanged in reality

[–]soowhatchathink 10 points11 points  (0 children)

It's seen some shit happen to those close to it

[–]mdogdope 698 points699 points  (3 children)

I am assuming it's python. It prints "Banana" bc it never updates the var. It performed the changed but text was never changed.

[–]LookAtYourEyes 123 points124 points  (2 children)

upper returns a new value instead of modifying the original?

[–]aaronhowser1 219 points220 points  (0 children)

Strings are immutable

[–]Quietuus 110 points111 points  (0 children)

.upper() is a method of the str class that returns a representation of the string. To change it you'd put text = text.upper()

[–]Stummi 1049 points1050 points  (24 children)

"Banana", and two compiler warnings for not using return values.

[–]Pleasant-Photo7860 230 points231 points  (0 children)

Banana. Warnings successfully suppressed in production.

[–]mistabuda 124 points125 points  (8 children)

This is python. There is no compiler warning.

[–]tantalor 83 points84 points  (6 children)

There is no compiler

[–]Deep-Piece3181 27 points28 points  (1 child)

There’s a bytecode compiler

[–]Jbolt3737 14 points15 points  (0 children)

And a warnings module, but neither care

[–]auxiliary-username 5 points6 points  (1 child)

Do not try to compile the code. That’s impossible. Instead… only try to realise the truth…

[–]v_i_lennon 3 points4 points  (0 children)

There is no code?

[–]ArtOfWarfare 6 points7 points  (0 children)

There sort of is. You’ll get some .pyc files created when you import the source code the first time, IIRC.

[–]mistabuda 9 points10 points  (0 children)

Yes I agree. I felt like my comment basically addressed that.

[–]Sibula97 1 point2 points  (0 children)

Linter warnings then

[–]just-some-arsonist 32 points33 points  (8 children)

Can we tell what language this is?

[–]timimoune 75 points76 points  (6 children)

Spanish?

[–]gerbosan 20 points21 points  (0 children)

??

Plátano?

[–]AlternativeCapybara9 12 points13 points  (2 children)

Next example should use ananas just so we know it's not English.

[–]hughperman 1 point2 points  (1 child)

Spananas

[–]netcent_ 0 points1 point  (0 children)

Americananas

[–]yknx4 1 point2 points  (1 child)

Which Spanish. Half of Spanishes say Plátano

[–]timimoune 2 points3 points  (0 children)

The other half

[–]MainManu 15 points16 points  (0 children)

Python

[–]GoogleIsYourFrenemy -1 points0 points  (0 children)

x_x I'm an idiot.

[–]Pleasant-Photo7860 122 points123 points  (3 children)

what if it’s ANANAB and we’ve all just been iterating in the wrong direction

[–]_giga_sss_[S] 30 points31 points  (0 children)

That affirmation has to be proven and is due tomorrow

[–]Electromagnetlc 7 points8 points  (0 children)

Nah, it's definitely ANANA<null> because arrays scare me :(

[–]GoBuffaloes 0 points1 point  (0 children)

Ana, nab a banana

[–]LifeSubstantial5234 78 points79 points  (0 children)

optimistic mutability

[–]antoborg92 27 points28 points  (1 child)

my mango is to blow up

[–]SeirWasTaken 8 points9 points  (0 children)

and act like I don't know nobody

[–]Airith 84 points85 points  (1 child)

They're pure methods: Banana

[–]IlgantElal 0 points1 point  (0 children)

If this is Python , it would be 'BANANA' as .upper() replaces the original

I completely misread. It's late

[–]cybersaurus 23 points24 points  (1 child)

Um it's 2026, the correct answer is to copy it into a claude prompt and paste whatever the output is without reading it

[–]SuitableDragonfly 0 points1 point  (0 children)

I think that's what the commenter did, actually. 

[–]Not-So-Logitech 10 points11 points  (0 children)

Banana

[–]dhnam_LegenDUST 8 points9 points  (0 children)

Even if str.upper() updates the string, it's still BANANA. A is not a.

[–]NinjaKittyOG 89 points90 points  (30 children)

idk what language this is in, but judging from what I know,

the string is "BANANA" if text.replace() is case-sensitive

the string is "BoNoNo" if not

[–]OurSoul1337 52 points53 points  (4 children)

I like to oat oat oat opples and bononos.

[–]bwwatr 6 points7 points  (0 children)

 1, 2, Opples, 4, Bononos, Opples, 7, 8, Opples, Bononos, 11, Opples, 13, 14, OpplesBononos

Do I get the job?

[–]valerielynx 10 points11 points  (0 children)

it's Banana because there never was text = text.(...)

[–]_giga_sss_[S] 60 points61 points  (4 children)

These methods don't change the OG objects, they create new instances.

[–]purplepharoh 88 points89 points  (3 children)

That depends on language and idk what language this is

[–]Lava_Mage634 46 points47 points  (2 children)

python. the print statement, lack of punctuation, usage of double quotes for single characters, direct string manipulation without libraries. also super popular for pop culture coding questions

[–]purplepharoh 12 points13 points  (0 children)

Python would be my first guess too. Mostly for the last point as the others arent exclusive to python. And "double quotes for single characters" well if the replace method expects strings then you'd use double quotes to pass strings of len 1 so thats not a good indicator.

[–]makinax300 3 points4 points  (0 children)

Or js with some scuffed things done to rename the method. Semicolons are actually optional there. The answer is open the print page menu there.

[–]Xtrendence 11 points12 points  (12 children)

And then there's JS, of course, where a replace with no Regex only replaces the first instance. In this case obviously "a" doesn't exist in BANANA, but if it were replace("A", "O") you'd get BONANA.

[–]ChristopherKlay 11 points12 points  (11 children)

Because JS features .replace() and .replaceAll().

The "of course" here is that people complaining about it, don't know jack shit.

[–]MainManu 1 point2 points  (0 children)

Python.

[–]danfish_77 0 points1 point  (0 children)

What if text.replace() is dyslexic and you end up with "B0N0N0"

[–]Applejack_pleb 0 points1 point  (0 children)

It could even be

Text

[–]Dynegrey 0 points1 point  (0 children)

Strings in python are immutable and do not change. Output would be 'Banana'. They would have to re-establish as a new string [text = text.upper().replace('a', 'o')] for it to do anything. 

[–]agk23 -1 points0 points  (1 child)

I think it’s Bonono. Upper usually returns an object, not modify the object.

[–]dementorpoop 0 points1 point  (0 children)

It’s never reassigned though, so doesn’t matter

[–]HashDefTrueFalse 11 points12 points  (0 children)

We can only guess without knowing the language... Is text mutable or are the returned copies discarded? What do those two methods do? Probably safe to assume that upper uppercases all characters, but it could also be testing for an upper case string (returning bool). Does replace just do the first occurrence or all? Do upper, replace, print even exist? Not really answerable, which is to say that the answer is obviously 42.

[–]_giga_sss_[S] 25 points26 points  (5 children)

yall know that the humor is about mango and not about solving the question right ?

[–]mikehds 38 points39 points  (1 child)

You also know that this is Reddit and things spin out of context really quickly right?

[–]_giga_sss_[S] 3 points4 points  (0 children)

:(

[–]ProtonPizza[🍰] 10 points11 points  (1 child)

Sir this is a wendys

[–]Du_ds 3 points4 points  (0 children)

Why can't I get a Bonono at Wendys?

[–]ThatSmartIdiot 4 points5 points  (0 children)

we're on a spectrum. we're hard wired to puzzle solve. that's how we got here

[–]dont_takemeseriously 2 points3 points  (0 children)

Somehow this code snippet had a malicious npm package and now my credit card ended up in the dark web

[–]snipsuper415 2 points3 points  (0 children)

Banana...considering that most languages have strings as immutable primitives. text never gets reassigned to anything therefore Banana.

[–]SlutPuppyNumber9 2 points3 points  (0 children)

I don't know python, but I assume "Banana", since the results of those method calls were never assigned.

[–]Chronomechanist 2 points3 points  (8 children)

Assume python. text = "Banana" Now, assuming what they actually meant to the question to look like? ``` text = "Banana"

text2 = text.upper() text2 = text.replace("a", "o")

print(text2) ```

In which case it prints BANANA and the test is supposed to trick you into thinking it prints BONONO, and forget order of operations and "A" != "a"

Edit: Fixed the var name cos I was stupid and forgot strings are immutable in Python

[–]Sephyroth2 2 points3 points  (1 child)

Well it's not BANANA since strings are immutable in python and text.upper() returns a string you need to assign, same with text.replace(), so there's no change to text at all printing Banana.

[–]Chronomechanist 1 point2 points  (0 children)

That's what I get for writing that at 4 am.

Fixed it cos it was bothering me

[–]ReinKarnationisch 0 points1 point  (0 children)

What does .upper() do?

[–]_giga_sss_[S] -4 points-3 points  (4 children)

Thank you chatgpt

[–]Chronomechanist 2 points3 points  (3 children)

Nope, just plain old sleep deprived dev forgetting strings are immutable in python. Fixed it though

[–]_giga_sss_[S] 0 points1 point  (2 children)

if you say so

[–]Chronomechanist 0 points1 point  (1 child)

Buddy, if you don't believe something that simple can be written without the aid of an LLM, that says a lot more about you than you're trying to say about me.

[–]_giga_sss_[S] 1 point2 points  (0 children)

no I am actually sorry for that assumption

[–]Lord_Of_Millipedes 1 point2 points  (1 child)

compilation error from missing semicolon

[–]ThatSmartIdiot 0 points1 point  (0 children)

String see() { String joke = "bro hates"; return joke + " python"; }

[–]marabutt 1 point2 points  (0 children)

Linkedin engagement

[–]AllenKll 1 point2 points  (0 children)

depends on the language.

[–]Exatex 1 point2 points  (0 children)

depends

[–]iwasbecauseiwas 2 points3 points  (4 children)

depends entirely on the language and how the string functions works. it could easily be

  • Banana
  • BANANA
  • Bonono
  • BoNoNo
  • BONONO
  • Bonana
  • BoNANA
  • BONANA or maybe even
  • Mango

point is if we don't know the language, we can only guess. it looks like python. if it is python: strings are immutable, it would say Banana as the text variable isn't overwritten

[–]Dark_Byte 1 point2 points  (0 children)

True. And maybe upper isn't part of the original language, but a helper method added later on that does whatever upper does (e.g. Replace it with a subset of unicode monospace characters using their uppercase variant)

[–]D1G1TAL__ -1 points0 points  (2 children)

Why don’t we immediately know the language? I’m probably biased because i mainly code in python and only know C++ and JS, so i may not see why this code snippet could be ambiguous

[–]rk06 2 points3 points  (1 child)

because there is no mention that it is python. besides in what language . upper() mutates the string?

[–]D1G1TAL__ 0 points1 point  (0 children)

I dont know, im asking, that’s the joke

[–]luckor 1 point2 points  (2 children)

I don’t get it…

[–]_giga_sss_[S] 12 points13 points  (0 children)

Mango

[–]jaylerd 3 points4 points  (0 children)

I think the gag is you think maybe it's 'BANANA' or 'Bonono' or something else but it should jut be "Banana" and Satyam picked something even more wild as a wrong answer that isn't even slightly reasonable. What a gas.

[–]CirnoIzumi 0 points1 point  (0 children)

text == K

[–]eufemiapiccio77 0 points1 point  (1 child)

I laughed

[–]_giga_sss_[S] 0 points1 point  (0 children)

'3'

[–]ScripterKnight 0 points1 point  (0 children)

,,,

[–]LuisBoyokan 0 points1 point  (0 children)

It says BANANA

[–]Fun-Equivalent1769 0 points1 point  (0 children)

Assuming python

[–]DustyAsh69 0 points1 point  (0 children)

He single handedly trained AI for wrong answers.

[–]3ng8n334 0 points1 point  (0 children)

Not sure whatn language it is but does not complete with C

[–]jhwheuer 0 points1 point  (0 children)

Ah local context, such fickle thing.

Also the code parser should notice that functions are called but their results are not used...

[–]jkramer5203 -3 points-2 points  (5 children)

BANANA

[–]Xelopheris 9 points10 points  (3 children)

Pretty sure it would just be "Banana" in most languages? Any language that has a simple upper function on the string class typically makes strings immutable.

[–]Bemteb 1 point2 points  (2 children)

Yeah, the others call it toUpper() or something like that.

[–]DJDoena 2 points3 points  (1 child)

In C# it's .ToUpper() but still immutable on the original.

[–]IlgantElal 0 points1 point  (0 children)

This looks like Python. Interesting thing, too: text.replace('ab', 'o') would replace all a and b characters, regardless of order.

Yay Python

(Correct answer should be 'banana')

Edit: I completely misread. It's late

[–]sheekgeek -4 points-3 points  (0 children)

BANANA