# filename:python2.24(2).py
# author:super
# date:2018-2-24
# 使用for打印出一个List
print(‘today to learn the ‘)
names = [‘aa‘, ‘bb‘, ‘cc‘]
for i in names:
print(i)
# 使用range来生成1,2,3,4,5
for value in range(1, 5):
print(value)
# 使用range来生成1-15的奇数
number = list(range(1, 15, 2))
print(number)
# 使用range来生成1-10的平方数
squares = []
for i in range(1,11):
squares.append(i**2)
print(squares)
# 使用range来生成1-10的平方数
squares2 = [i**2 for i in range(1, 11)]
print(squares2)
# practice
for i in range(1,21):
print(i)
list2 = list(range(1, 21, 2))
for i in list2:
print(i)
# 生成1-30中可以除以3的整数
list3= list(range(1, 31))
b = []
for i in list3:
if(i%3==0):
b.append(i)
else:
continue
print(b)
# 使用range来生成1-10的立方数
list4 = [i**3 for i in range(1,11)]
print(list4)