Print Statement
The Print Statement
In this activity, we begin to explore the use of the print
statement. The print statement is a useful and important
function in Python because it allows us to extract information from our
code and display it on the screen.
This is useful for creating outputs, checking whether code is working correctly, debugging errors, and providing information to a user.
What doesprintdo?
The print function sends information from a Python
program to the output area. In a Jupyter Notebook, this output is
displayed directly below the code cell after the cell is run.
Why isprintuseful?
The print function is often used when learning Python
because it gives immediate feedback. It can show the result of a
calculation, display the value of a variable, or help identify where
an error may be occurring.
Exercise: Print Statement
You now have an opportunity to write and test your own code. Please use Anaconda and Jupyter Notebook to complete the exercise.
Run your code and save the file. You may also want to make note of the steps you followed, the results you obtained, and any errors you encountered.