for number in range(1,100):
print(number)
number=list(range(1,100))
print(number)
#创建数表的两种方式,其中range可以设置步长
numbers=[number**2 for number in range(1,10,2)]
#第一部分为表达式,对数值进行运算,第二部分用于给表达式提供数值
print(numbers)
number=list(range(1,100))
for A in number:#for 循环输出
print(A)
number=list(range(1,1000000))#最小、最大、求和
print(min(number))
print(max(number))
print(sum(number))
numbers=[number for number in range(3,30,3)]#3~30内被3整除的数
for B in numbers:
print(B)
numbers=[number**3 for number in range(1,11)]#立方
for C in numbers:
print(C)
number=range(1,3)
print(number)
数表计算~
|