So…
One really cool thing about Python is that it’s a really straight forward language. You can see many examples of this, like printing something, making a conditional, and other stuff. One does not need to go through too much trouble to wrap ones head around understanding how Python works. Another example is the topic of this post: Basic data types.
Some basic data types in Python are:
Integers: They’re simply whole numbers from negative infinity to infinity. Just numbers without decimals. Big, pretty, and whole numbers.
Example: x = 4
Float: Every rational number. This is cool because you can have decimals. It’s pretty neat if you ask me.
Example: x = 4.2
Stings: Stores character! It’s a set of letters, numbers or anything else, like punctuations.
Example: x = “Neat”, x = ‘Neat’
Tuples: It’s a list of fixed number of elements, it’s expressed with a parenthesis.
Example: x = (2,3,4)
Lists: Kind of like Tuples but the list doesn’t have a fixed number of elements, it’s expressed with square brackets. (I find lists really cool too by the way.)
Example: x = [2,3,4]
Dictionaries: It contains multiple elements.
Example: x = {2:1}
Mastery 9 – Basic types and their use in Python by drag04 is licensed under a Creative Commons Attribution 4.0 International License.