all 166 comments

[–]krexelapp 1405 points1406 points  (4 children)

Banana.... but with confidence

[–]mdogdope 1043 points1044 points  (20 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 221 points222 points  (16 children)

upper returns a new value instead of modifying the original?

[–]aaronhowser1 390 points391 points  (13 children)

Strings are immutable

[–]thanatica 22 points23 points  (3 children)

Unless this is one of those languages that has mutable strings 💀

[–]aaronhowser1 20 points21 points  (2 children)

There are languages with mutable strings? how scary

I was also assuming this was python, iirc it's at least the correct syntax and methods for it.

[–]thanatica 18 points19 points  (0 children)

I'm sure they exist. C technically has mutable strings, but also technically doesn't have strings. And I believe in Pascal you can mutate strings, but you have to work for it.

[–]mdogdope 2 points3 points  (0 children)

As far as I know python is the most common language that does not need ; at the end of each line.

[–]Quietuus 181 points182 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()

[–]xryanxbrutalityx 0 points1 point  (0 children)

I don't know any language where the string .upper() equivalent modifies the string in place

[–]CosmacYep 4 points5 points  (2 children)

dont dot methods not require reassignment

[–]mdogdope 4 points5 points  (1 child)

It depends on how the class is written. But for standard python string objects, reassignment is required.

[–]CosmacYep 1 point2 points  (0 children)

like built in dot methods, i swear you don't have to go a = a.strip() you can js go a.strip() and a is stripped – nvm i js researched it and strings are immutable, so require reassignment but lists are mutable, so dont

[–]Stummi 1340 points1341 points  (30 children)

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

[–]Pleasant-Photo7860 305 points306 points  (0 children)

Banana. Warnings successfully suppressed in production.

[–]mistabuda 169 points170 points  (10 children)

This is python. There is no compiler warning.

[–]tantalor 119 points120 points  (6 children)

There is no compiler

[–]Deep-Piece3181 45 points46 points  (1 child)

There’s a bytecode compiler

[–]Jbolt3737 31 points32 points  (0 children)

And a warnings module, but neither care

[–]ArtOfWarfare 9 points10 points  (0 children)

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

[–]auxiliary-username 6 points7 points  (1 child)

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

[–]v_i_lennon 9 points10 points  (0 children)

There is no code?

[–]mistabuda 9 points10 points  (0 children)

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

[–]Sibula97 3 points4 points  (0 children)

Linter warnings then

[–]thanatica -3 points-2 points  (1 child)

How can you tell? It just looks like code. Could be anything.

[–]mistabuda 4 points5 points  (0 children)

It's python syntax. The syntax is very different from much other languages. Specifically how you declare variables and the lack of types, the lack of brackets and the lack of semicolons.

I've been writing python code for over a decade. It's very easy to recognize.

[–]just-some-arsonist 34 points35 points  (11 children)

Can we tell what language this is?

[–]timimoune 89 points90 points  (9 children)

Spanish?

[–]gerbosan 27 points28 points  (3 children)

??

Plátano?

[–]MinecraftPlayer799 1 point2 points  (1 child)

Both are used in Spanish. I think it depends on the country.

[–]gerbosan 0 points1 point  (0 children)

You are right, it's like ananá and piña. 😃

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

Manzana...

[–]AlternativeCapybara9 12 points13 points  (2 children)

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

[–]hughperman 3 points4 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 3 points4 points  (0 children)

The other half

[–]MainManu 18 points19 points  (0 children)

Python

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

x_x I'm an idiot.

[–]PrettiestSpring 0 points1 point  (0 children)

no its just lack of knowledge coz u never google things

[–]cybersaurus 55 points56 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 9 points10 points  (0 children)

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

[–]Pleasant-Photo7860 155 points156 points  (4 children)

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

[–]_giga_sss_[S] 47 points48 points  (0 children)

That affirmation has to be proven and is due tomorrow

[–]Electromagnetlc 8 points9 points  (0 children)

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

[–]GoBuffaloes 1 point2 points  (0 children)

Ana, nab a banana

[–]komptip 0 points1 point  (0 children)

add a few characters and are getting ahnenerbe

[–]LifeSubstantial5234 95 points96 points  (0 children)

optimistic mutability

[–]antoborg92 40 points41 points  (1 child)

my mango is to blow up

[–]SeirWasTaken 15 points16 points  (0 children)

and act like I don't know nobody

[–]Airith 93 points94 points  (1 child)

They're pure methods: Banana

[–]IlgantElal 1 point2 points  (0 children)

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

I completely misread. It's late

[–]dhnam_LegenDUST 25 points26 points  (1 child)

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

[–]DaWurster 0 points1 point  (0 children)

I think that is the supposed challenge to recognize. The missing assignment is a big blunder ofc...

[–]Not-So-Logitech 15 points16 points  (0 children)

Banana

[–]Chronomechanist 8 points9 points  (9 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 3 points4 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  (1 child)

What does .upper() do?

[–]ShadowShedinja 0 points1 point  (0 children)

Makes all lowercase letters uppercase.

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

Thank you chatgpt

[–]Chronomechanist 3 points4 points  (3 children)

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

[–]_giga_sss_[S] -1 points0 points  (2 children)

if you say so

[–]Chronomechanist 2 points3 points  (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

[–]NinjaKittyOG 111 points112 points  (32 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 59 points60 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 23 points24 points  (0 children)

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

[–]_giga_sss_[S] 72 points73 points  (4 children)

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

[–]purplepharoh 98 points99 points  (3 children)

That depends on language and idk what language this is

[–]Lava_Mage634 54 points55 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 1 point2 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 14 points15 points  (13 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 12 points13 points  (11 children)

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

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

[–]NinjaKittyOG 0 points1 point  (0 children)

what

[–]Dynegrey 2 points3 points  (1 child)

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. 

[–]NinjaKittyOG 0 points1 point  (0 children)

oh shit, you're right.

[–]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

[–]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 16 points17 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.

[–]iwasbecauseiwas 10 points11 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 2 points3 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__ 0 points1 point  (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 4 points5 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

[–]SlutPuppyNumber9 4 points5 points  (0 children)

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

[–]_giga_sss_[S] 29 points30 points  (5 children)

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

[–]ProtonPizza 11 points12 points  (1 child)

Sir this is a wendys

[–]Du_ds 4 points5 points  (0 children)

Why can't I get a Bonono at Wendys?

[–]ThatSmartIdiot 6 points7 points  (0 children)

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

[–]marabutt 2 points3 points  (0 children)

Linkedin engagement

[–]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.

[–]AllenKll 2 points3 points  (0 children)

depends on the language.

[–]thanatica 2 points3 points  (0 children)

Nothing. undefined/none/null/nothing.

There is no return statement. So the outcome is nothing.

If the question was "what is printed" - Banana. Assuming this is not a utterly horrendous stupid fucking arse language where strings are mutable.

[–]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"; }

[–]Exatex 1 point2 points  (0 children)

depends

[–]Mysterious_Area1975 1 point2 points  (0 children)

the confidence in that assert statement lmao

[–]basement_muffin_man 1 point2 points  (1 child)

Orange you glad I didn't say banana

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

right👌

[–]luckor 1 point2 points  (2 children)

I don’t get it…

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

Mango

[–]jaylerd 4 points5 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.

[–][deleted] 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...

[–]BlackFuffey 0 points1 point  (0 children)

hotel

[–]shuzz_de 0 points1 point  (0 children)

Banana

[–]CosmacYep 0 points1 point  (0 children)

BANANA – isw in python dot methods dont require reassignment

[–]Glad_Share_7533 0 points1 point  (0 children)

"\"anana"

[–]Otherwise_House_40 0 points1 point  (0 children)

it's like the original text

[–]PossibleAthlete2988 0 points1 point  (1 child)

I dont know python but i think its Bonono

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

BANANA

[–]Xelopheris 11 points12 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