L = range(1, 101)
print L[0:10]
print L[2:101:3]
print L[4:51:5]
print L[0:10]
print L[2:101:3]
print L[4:51:5]
2019-09-02
sum = 0
x = 1
while x < 100:
sum = sum + x
x += 2 #这里x初始为1,每次加2就会变成奇数
print sum
x = 1
while x < 100:
sum = sum + x
x += 2 #这里x初始为1,每次加2就会变成奇数
print sum
2019-09-02
sum = 0
x = 1
while x <= 50:
sum = sum + (2*x-1)
x = x+1
print sum
x = 1
while x <= 50:
sum = sum + (2*x-1)
x = x+1
print sum
2019-09-01
最赞回答 / weixin_慕雪4019729
# -*- coding: utf-8 -*-print '''静夜思床前明月光,疑是地上霜。举头望明月,低头思故乡。'''保留上面的释义,第一行的U 去掉,是编译器版本的问题
2019-09-01
最新回答 / 爱吃韭菜的白菜
#-*- coding:utf-8 -*- L = range(1, 101) B = [x for x in range(1,101) if x <=50 and x%5==0] print (L[:10]) print ([x*1 for x in L if x%3==0])#3的倍数 print (B)#不大于50的5的倍数研究了几天,终于知道出错问题了。
2019-08-31
L = ['Adam', 95.5, 'Lisa', 85, 'Bart', 59]
print L 这样就可以通过了
print L 这样就可以通过了
2019-08-30