Press "Enter" to skip to content

Python Example 3 – Strings in Python

Example #3 Strings in Python

This post will use a trinket to display the source demoing the use of strings in Python. The source is commented for context, the output may be seen in the trinket by running it.

Demoing Strings

*Note: With the trinket widget you may toggle between the code (Pencil icon) and the output (Play button). Please visit my GitHub if you would like to look at all of the Python source code. Laszlo’s GitHub.

Demoing Strings with Python 3 Syntax in Python 2

*At the time of this post trinket does not support importing __future__, which allows the use of the explicitly requested feature of Python 3 in Python 2. Bellow is the source example.

from __future__ import print_function

#Example demoing how to use the print function from Python 3
print(‘Hello World’)

Leave a Reply

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