Image credit to @goumbik https://www.pexels.com/@goumbik

Learn Programming with Python — Introduction to Data Types: Strings

Richard Quinn
The Startup

--

Let’s explore the concept of data types and how Python represents text data as strings.

A Quick Review

In earlier instalments of this series we already came into hand-to-hand contact with different types of data:

  • String data was input from the console or output to the screen
  • Integer data was used to test different age conditions
  • Boolean data was used to control program flow

We also used Sets and Tuples to collect individual pieces of data into data structures. We won’t go deep into data structures in this instalment, but we will reuse the tuple and set structures we’ve already seen.

In this instalment we’re going to get our fingers typing Python code to illustrate how Python uses data types, specifically data types to work with text data.

Text Data Types in Python3

Text data, comprised of characters, is managed in Python as :

  • str data types contains a string of characters (even an empty sequence) such as Hello, World!

There are no other data types for textual data in Python. str is all you get, and is likely all you really need!

--

--

Richard Quinn
The Startup

I am a software engineering manager with over 25 years of experience. I am working to improve people’s health. Based in Basel, Switzerland.