Hotline
0388011834
Trang chủ/ Góc lập trình/Lập trình Python

[Code Python] Bài 1: Kiểu dữ liệu cơ bản



Danh sách các kiểu dữ liệu cơ bản trong Python:

string_type = "Kieu string"
print(string_type)
print(type(string_type))

integer_type = 12
print("\n", integer_type)
print(type(integer_type))

float_type = 3.14
print("\n", float_type)
print(type(float_type))

boolean_type = True
print("\n", boolean_type)
print(type(boolean_type))

list_type = [1, 2, 3]
print("\n", list_type)
print(type(list_type))

dictionary_type = { "key1": "value1", "key2": 123 }
print("\n", dictionary_type)
print(type(dictionary_type))

set_type = {1, 2, 3}
print("\n", set_type)
print(type(set_type))

tuple_type = (1, 2, 3)
print("\n", tuple_type)
print(type(tuple_type))

Kết quả sau khi chạy chương trình:

Kieu string


 12


 3.14


 True


 [1, 2, 3]


 {'key1': 'value1', 'key2': 123}


 {1, 2, 3}


 (1, 2, 3)

Video: