For example:
If you code this into the interactive mode then the output would show up under it
X=126
X*420
As you can see on the left side is the script, and when executed there was no output on the right, or the shell. This is because we didn’t tell Python to print out the output which is sometimes confusing as stated before. “But if you type the same code into a script and run it, you get no output at all. In script mode an expression, all by itself, has no visible effect. Python actually evaluates the expression, but it doesn’t display the value unless you tell it to:” (Downey 17).
Since we added the print command in the script there was a
visible output like in the interactive mode.
Question: What are some other scenarios where you need more
than one resource to be successful?
Downey, Allen B. Think Python: How to Think like a Computer Scientist. Sebastopol: O'Reilly Media, 2015. Print.
0 comments:
Post a Comment