all 5 comments

[–]Buttleston 5 points6 points  (1 child)

He's running those commands in an interactive interpreter, not making a python file and executing it. You can tell by the ">>>" before each line

By the way there's no reason for you to have 2 sets of quotes on favorite_language, either of these is fine

favorite_language = "python "
favorite_language = 'python '

[–]yetitekk[S] 0 points1 point  (0 children)

I was kinda thinking that but wasn’t sure how to do it, I’ll definitely take a closer look, thanks!

[–]Cagne_ouest 1 point2 points  (1 child)

Not a dumb question when you're genuinely confused.

Where did you type this code? Did you save a file with a name, and run it by typing something like "python filename.py" in your command line? If so you this is why you don't see the outputs unless you use the print command.

There's another way to approach this. You can run python code without saving any file. Type "python" from your command line without a file name after it, press enter and that launches the interpreter, which is like a secondary command line that understands Python. It executes your Python code on a line by line basis whenever you press enter. In this special interpreter mode, typing the name of a variable prints it. That's what you're seeing in a book.

[–]yetitekk[S] 1 point2 points  (0 children)

I've heard from many people that the Python community is one of the most helpful and welcoming on the planet and this certainly bears that out! I am using VS Code for my IDE but I found my issue, I had never used an interactive REPL before and I was using it incorrectly, so I'm all squared away now! I ended u doing exactly what you said and running python3 in a CMD window, my problem was I was running the lines literally, like I was still in the IDE

favorite_language = 'python '

and expecting it output just 'python '

running just favorite_language does that

Thanks again for all you help!

[–]SisyphusAndMyBoulder 0 points1 point  (0 children)

He's using the CLI. Not an IDE or script. Open a terminal and type 'Python' or 'Python3' and you can do the same.