Introduction to basic built in data types in the python foundation tutorial

  • 2020-04-02 13:26:26
  • OfStack

What are Python's basic built-in data types

Some basic data types are integers (Numbers), strings, tuples, lists, dictionaries, and Boolean types.
As you progress, you'll be exposed to more and more interesting data types, just a few of which you'll need to get started with python.

Basic built-in data types correspond to symbols

1) integer -- int -- number
Python has five number types, the most common being int. For example: 1234, -1234
2) Boolean -- bool -- represented by the symbol = =
Boolean is a special python number type. It has only True and False values. It is mainly used for comparison and judgment. For example: 3==3 gives True, 3==5 gives False
3) string -- STR -- represented by ' 'or ""
For example: 'www.iplaypython.com' or 'hello'
4) list -- list -- with the [] symbol
For example: [1, 2, 3, 4]
5) tuple -- tuple -- represented by the () symbol
For example: (' d ', 300)
6) dictionary -- dict -- is represented by the {} symbol
For example: {' name ':' coco ', 'country' : 'China'}

Which of Python's basic data types are mutable and which are immutable

Python variable data type: list[], dictionary dict{}
Python immutable data types: int, string STR ", tuple()


Related articles: