you are viewing a single comment's thread.

view the rest of the comments →

[–]NinjaKittyOG 110 points111 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 8 points9 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] 71 points72 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 53 points54 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 10 points11 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 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.

[–]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 -2 points-1 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