#2 Print Function

Previous post: https://codinghelp.site/knowledgebase/python/installing-python-pycharm/

Next post: https://codinghelp.site/knowledgebase/python/3-input-function/

The Print Function

In python, to send a message to the console we use something called print(). In the parentheses we pass in what would we like to print.

The Print Function Syntax

This is how we would print Hello World in the console. The quotes are a declaration of β€œtext” (python name for this: string). We can use double quoted (β€œ) and single quoted (β€˜) quotes in the print function.

Example

This would print Hey!! to the console. Simple as that.

Exercise

Make a script that prints Hey! How are you? to the console.

Answer Key

image

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.