Recent Posts

python built in data type to learn



Hello I am Juny.

I will introduce built-in data types in python language.
the detail of them is not handled in this post.

I will introduce the important detail of them in the next post.

I referred to built-in types in python official homepage.



built-in types in python


at first, there are built-in types like below.

  • numeric types
  • iterator types
  • generator types
  • sequence types
  • set types
  • mappings types

I will introduce them briefly.
before beginning,
everything that is in python is object.

so, each type is an object that has own methods and attributes.


numeric types



  • int
  • float
  • bool
  • complex

there are 4 types of numeric types.

int is integer type.
float is floating point number type.
in general, the precision of float is same to C language's double.
bool is logical value type.
there are 2 constants in python for True and False.
complex is complex number type.

numeric type is created by number literal.
otherwise,
it can be also created by relative methods and the result of operations.

numeric type has various methods and operators for doing operations.

I will the detail in the next post that is about numeric type.



iterator types


"iterate" has the meaning of "repeat".
like the meaning, iterator support the iteration of data container.

user-defined data types can also have iteration using iterator types.

the detail will be handled by the next post that is about iterator.




generator types


generator provide a convenient way to implement iterator protocol.

the detail will be handled by the subject of generator.


sequence types


  • List
  • Tuple
  • Range
  • String
  • Binary data

they are sequence types.
it is like container for data.
it can contain multiple data.

when you are programming,
they would be used most often.

they support iteration.

each one has many own methods and attributes.

the detail will be handled by the subject of sequence types.




set types


  • set
  • frozenset

set is unordered collection.
it has mathematical operations such as intersection, union, difference and symmetric difference.

indexing and slicing is impossible because it is unordered.

set is mutable data.
frozenset is immutable data.

mutable means that data can be modified.
immutable means that data cannot be modified.

the detail will be handled by the subject of set.



mappings


mappings type is dict in python.
dict is only one for mappings in python.

dict map any key to any value.
key is immutable.
value is mutable.

the detail will be handled by the subject of mappings)


thank you for reading this.







python built in data type to learn python built in data type to learn Reviewed by Juny on 7월 17, 2019 Rating: 5

댓글 없음:

Powered by Blogger.