Python is a high-level programming language with a rich set of built-in data types that help developers process and manipulate data efficiently. Below we will introduce Python built-in data types in detail and provide corresponding sample code.
-
Numbers:
Number types in Python include integers (int), floating point numbers (float), and complex numbers (complex). They are used to represent different types of numeric values.Sample code:
# 整数 num1 = 10 print(num1) # 输出:10 print(type(num1)) # 输出:<class 'int'> # 浮点数 num2