0

new to programming and i am reading through a a couple intro to programming concepts using python books, and i am seeing a contradiction between the texts and what i am seeing in my python document. particularly, as you see in this screen shot of interpreter and shell

my confusion is in relation to how strings are printed, or rather not printed, when typing them into the interpreter (?) window. when i type ''see how this prints'' in the shell, it returns 'see how this prints'.

but when i type this same string in the interpreter (?), and run python over it, the shell that pops up doesnt contain the string, unless i typed 'print("see how this prints")', which will return 'see how this prints' in the shell.

the texts indicate it should return the same string in both windows. is this a misunderstanding of how python works? or is this a discrepancy because i am using IDLE and there using a different IDE?

sorry if this is too obvious of a question, but i am teaching myself and didnt find a similar question here in superuser

0

When you type something in the interpreter with quotes around it the terminal just spits out that exact same thing but when you are writing a python code, in order to print something you have to use the print command.

0

When you type a string in the interactive window without using the print function you are given back its representation, with quotes. When you use the print function you are given the literal, without quotes. They are the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.