Python学习笔记2
# coding=gbk,程序编码问题,不识别中文
num = ['1','2','3']
for list1 in num:
print(list1)
# 生成数值列表
numbers = list(range(1,11))
for number in numbers:
print(number)
#添加元素
numbers.append(15)
print(numbers)
#统计
print(min(numbers))
print(max(numbers))
print(sum(numbers))
#列表解析
squares = [value**2 for value in range(1,11)]
print(squares)
#复制列表
my_food = ['huji','jiok','jiki']
my_friend_food = my_food[:]
print(my_friend_food)
my_friend_food.append('juhg')
print(my_friend_food)
#元组表示值不能修改,只能重新赋值
dimension = (500,90)
不多说,如上代码,初学笔记,省略自认为不需要的部分