Các kiểu biến trong Python

Type int

x = 5
print(type(x))

Type Float

x = 5.5
print(type(x))

Type String

x = ‘Chung! dep trai’
print(type(x))

Type Boelean

x = True
print(type(x))

Type Comple Số phức

x = complex(3,2)
print(type(x))
print (x.real,x.imag)

Type other

import sysconfig
print(sysconfig)

'''
Created on 2019/08/26

@author: ChungIT.Home.Blog
'''
# Type int
x = 5
print(type(x))
#Type Float
x = 5.5
print(type(x))
#Type String
x = 'Chung! dep trai'
print(type(x))
#Type Boelean
x = True
print(type(x))
#Ty Comple So phuc
x = complex(3,2)
print(type(x))
print (x.real,x.imag)

import sysconfig
print(sysconfig)

Kết quả:

<type 'int'>
<type 'float'>
<type 'str'>
<type 'bool'>
<type 'complex'>
(3.0, 2.0)
<module 'sysconfig' from 'C:\Users\600205\Downloads\pleiades\python\2\lib\sysconfig.pyc'>

Chào mừng bạn đến với blog của tôi! Đây là nơi tôi chia sẻ những trải nghiệm, suy nghĩ và kiến thức mà tôi học được trong cuộc sống và công việc. Hy vọng bạn sẽ tìm thấy điều gì đó hữu ích và thú vị tại đây.

Design a site like this with WordPress.com
Get started