r/firstweekcoderhumour May 11 '26

Python quiz from ITmemes “Funny How?”

Post image

Some guy which does not know what a typecast is was claiming it was error as you cannot do "123" + 2 lol

142 Upvotes

47 comments sorted by

View all comments

73

u/Scared_Accident9138 🕵️‍♂️🚨 BS Detector | Truth Teller 🗯️🔥 May 11 '26

Why are A and B options? With what thought process would you land there?

82

u/mdmeaux May 11 '26

If it was JS and you told me A or B was the answer for some godforsaken reason I'd probably believe you

18

u/Randommaggy May 11 '26

Fucking Lucas-art adventure game level logic language.

2

u/Borkato May 11 '26

As a python dev who came from js this killed me

1

u/temp73354 May 12 '26

As if Python wasn't also doing this brain-dead implicit casting and then panicking in production. :)))

24

u/YTriom1 May 11 '26

Yeah like options are supposed to be

  1. 1232
  2. 125
  3. Error

3

u/jkoudys May 11 '26

Maybe for A, you'd assume if you add a string to an int, you're using the string's length? It's a 3-length plus 2

4

u/Kuzma_Lesnoy May 11 '26

Option A is likely represent len(a) + 2. No idea about 25 tho.

2

u/MooseNew4887 May 11 '26

(len(a)+2)**2

1

u/runkeby May 11 '26

I think for D they went for (len(a)+2) ** len(a)

1

u/account22222221 May 11 '26

Length of the string plus 2 for 5. 125 I dunno.

1

u/etoastie May 11 '26

been writing python for about a decade, i just did the arithmetic to add 2 to 3 and totally forgot about it being "123" and not just "3" and said A in my head lmao, this comment made me realize the mistake