Introduction to Data Types

code guest
Python Journey
Published in
2 min readAug 6, 2019

Data to a programmer is like ingredients to a chef.

As coders, we cook up exciting programs by crafting with data information.

These data can come from various sources eg.

  • Research data
  • Data sources like public records
  • User input (such as filling forms etc)

We would write commands in our programs to handle these data such as to display “hello world” on our screens in which case we are working with text data in the form of “hello world”.

When we introduce data to our Python program, Python stores this piece of data in our computer memory as a Python object with a data type.

Data like text information are of string data type while numbers are represented by integer and float data types. Data can also come in the form of boolean values which are either True or False.

Programmers work with data information of different data types (credits: undraw.co)

Data types are very useful because programming languages let us perform different operations with data based on their data type.

In python, string data type supports the capitalisation operation (eg. “hello” to “HELLO”) while integer & float data types support mathematical operations (eg. 10*10 to 100).

Programmers need to know how to use different data types — eg.

- check if a visitor is logged in using boolean values (boolean data type)

- display the visitor’s username and profile details (string data type) on screen.

Therefore, a good way to start programming would be to learn about data types.

Summary

  • Programmers work with data
  • Data (eg. numbers, text) comes in different data types
  • Data types have their own specific operations

Quiz

Which options are correct about data types?

a) There is a number data type in Python

b) 100 and “100” look similar but are of different data type

c) Different data types support different operations

d) Data of no data type at all exist in Python

Quiz explanation

a) Numbers or numerical data are of either integer or float data type

b) 100 is an integer while “100” is a string

c) Option c is correct

d) Every piece of data has an associated data type

Quiz answers: b & c

--

--