From the course: Programming Foundations: Data Structures

What is data?

- In computer science, data is information that is stored or processed by a computer. While that might seem fairly abstract, there are actually lots of data points we use in everyday life. A birthday, that's a data point. Latitude and longitude of a specific location, that's a piece of data. The name of a city, whether a store is open or closed, your initials, these are all data points. These can all be considered pieces of data, and we store them in different ways within a computer, but how exactly do we represent these in our code or use them in our programs? Well, the short answer is that it's a lot of ones and zeros. However, to make things a little easier, programming languages have created something called data types that we use to represent common pieces of data in our code. What are some common data types? Think numbers, letters, true false values, and the programs we create, we use and store a lot of these, and programming languages have created conventions on how these pieces of data can be described and manipulated in code. We classify different pieces of data with data types based on their value. For example, there's a data type for letters and symbols, and there are various data types for numbers. So a data type is defined by the possible values it can be, but it's also defined by how we operate on that piece of data. In the most general sense, we can think of whole numbers as a data type. Now, usually this is called something else by developers, which we'll get to, but it's the set of possible values that includes every whole number between a very high upper limit and a very low lower limit. Operations wise, we can add numbers, subtract them, and more. In Python, we have four core primitive data types, int, float, boolean and string. Any whole number is classified as an integer. We represent numbers with decimal points as floats. For true false value, we classify it as a boolean. To represent textual information, we use the string data type. In fact, you can use the type function in Python to discover what data type a given value or variable is classified as. Unlike other languages, these data types are not explicitly written out with syntax. It's implicit, but just because you aren't writing it out doesn't mean it doesn't exist.

Contents