r/PythonLearning • • Aug 12 '25

Why not 4th!

Post image

In the fourth argument is the string "end1 ", then why is the correct answer the 1st one
This is a Codechef practice problem

11 Upvotes

14 comments sorted by

6

u/ImBonVoyage Aug 12 '25

It’s a lowercase L. It’s the same character in hello and world.

4

u/[deleted] Aug 12 '25

Yeah, it's just the font. Lowercase "L" does look like 1

4

u/LionZ_RDS Aug 12 '25

Were the answers specific designed with the font being easy to misread in mind? That’s not even testing your programming knowledge

2

u/cafesito_asere Aug 12 '25

As previously stated this is just a font issue, although it looks like a one, the character at the end of the string is a lowercase L.

2

u/NaiveEscape1 Aug 12 '25

Can anyone please tell me why it printed 5, isn’t that a integer data type as its not in quotes?

1

u/No_Cook_2493 Aug 12 '25

You can print integer data types in python. Print("number ",5) will output number 5 in the console

1

u/Temporary_Pie2733 Aug 12 '25

print is essentially just a wrapper around some file-like object’s write method, except it does a lot of processing of its arguments to produce the single str value expected by write. Part of that processing is to convert any non-str value to a str using its __str__ method. 

2

u/ninhaomah Aug 12 '25

Why do you think it's end1 ? 

l in Hello and the "l" character in endl looks the same , no ?

1

u/textBasedUI Aug 12 '25

That’s an evil challenge if I was new and failed that I would be dismotivated forever

1

u/LostInGradients Aug 12 '25

I guess that is to teach people to look for hidden typos?

1

u/[deleted] Aug 12 '25

ig its 2nd 😭

1

u/ilidan-85 Aug 13 '25

Horrible example with misleading font. It happens sometimes but please... :D

1

u/Xamtos Aug 15 '25

Wouldn't this show up as "HelloWorld5endl2"

1

u/[deleted] Aug 16 '25

Bad question intended to trip you up for using the wrong font.

You'd never ask this kind of question in an academic setting unless you were trying to intentionally trick students, which no good professor would ever do.

A better question would be something like:

What is the result of the following code:

print("Hello world!" * 5)

Or something similar.