列表存在的意义


1、简化变量的赋值

name = '张三'
age = 32
sex = '男'

a = ['张三', 32, '男']

2、分类存放数据

sex1 = '男'
num1 = 1
name1 = '张三'
sex2 = '女'
num2 = 2
name2 = '李四'
sex3 = '未知'
num3 = 3
name3 = '王九'

sexes = ['男', '女', '未知']
nums = [1, 2, 3]
names = ['张三', '李四', '王九']

results matching ""

    No results matching ""