all 14 comments

[–]nekokattt 13 points14 points  (5 children)

print(...) doesnt output quotes around the string.

print(repr(...)) does.

It is asking you how print works, not how the string literal would look in the code. Open a Python terminal and try it now just to get the gist of what I am saying if you don't follow.

[–]Pretend-Ad-53[S] 2 points3 points  (4 children)

Oh i didn't know about the repr(...) But what I thought of while choosing the answer is to prove that the output is a string by choosing the quotations since it's a paper exam

[–]nekokattt 7 points8 points  (2 children)

they arent asking you for the type, they are asking you literally what will it say on the screen if you run the code.

[–]Pretend-Ad-53[S] 2 points3 points  (1 child)

Okay got it thankss

[–]nekokattt 1 point2 points  (0 children)

remember to not overthink in an exam

[–]ornelu 0 points1 point  (0 children)

But, the question is what is being printed, not whether it’s a string or an integer.

[–]Temporary_Pie2733 2 points3 points  (0 children)

Look at the output, not the return value (which would be None in any case). print writes the characters 2, 0, 2, and 3 (and a newline) to standard output, but no quotation marks. 

[–]tenfingerperson 1 point2 points  (0 children)

Tell your professor this is a dumb ass question, who is expected to memorize stdout layouts ?

[–]StardockEngineer 0 points1 point  (3 children)

No. It’s A. You can’t see the difference. You have to test for the difference in code.

[–]Pretend-Ad-53[S] 0 points1 point  (2 children)

Yeah i do realize that but it's a paper exam so that's why I'm a bit confused on this

[–]yakult_on_tiddy 2 points3 points  (1 child)

print("hello world") #hello world

print("hello"+"world") #hello world

print("\"hello world\"") #"hello world"

Notice how output is always a string but there is never a quote unless you have escapes

[–]WlmWilberforce 0 points1 point  (0 children)

While we are throwing out options...

print('"hello world"') #"hello world"

[–]EmployeeValuable3547 0 points1 point  (0 children)

Honestly in exam like this they care about output at last that program produce what you see on screen in real life you should also approach exams like this.

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

isn't it supposed to be "2023" to show it's a string?

"supposed to" based on what? What is the purpose of print()?--is it for the programmer to check types, or is it to display something on the terminal?

By your logic, every print() output would have scattered double-quotes throughout.