Loading section...

Data Types and Strings

Every piece of data in your program has a type. The type determines what you can do with that data and how the computer stores it in memory. Think about the number "5" and the text "5". They look the same, but they're fundamentally different: They behave completely differently: The first gives 15 (mathematical addition). The second gives "510" (text concatenation). Trying text_five + 10 causes an error because you can't add text and a number directly. Data types exist because computers need to know how to interpret the 1s and 0s stored in memory. The same binary pattern could represent a number, a letter, or something else entirely, depending on its type. The Four Fundamental Types Python has many data types, but four are fundamental. Almost every program uses these: Checking Data Types Wo