x1 = 1
d = 3
n = 100
x100 = x1+d*(n-1)
s = (x1+x100)*n/2
print s
d = 3
n = 100
x100 = x1+d*(n-1)
s = (x1+x100)*n/2
print s
2015-06-08
def square_of_sum(L):
sum = 0
for x in L:
sum = sum + x * x
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
def square(L):
sum = 0
for x in L:
sum += x*x
return sum
print square([1,2,3,4,5,6,7,8])
sum = 0
for x in L:
sum = sum + x * x
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
def square(L):
sum = 0
for x in L:
sum += x*x
return sum
print square([1,2,3,4,5,6,7,8])
2015-06-08
L = []
x = 1
while x <= 100:
L.append(x*x)
x += 1
print sum(L)
L = [x*x for x in range(1,101)]
print sum(L)
L = []
for x in range(1,101):
L.append(x*x)
print sum(L)
x = 1
while x <= 100:
L.append(x*x)
x += 1
print sum(L)
L = [x*x for x in range(1,101)]
print sum(L)
L = []
for x in range(1,101):
L.append(x*x)
print sum(L)
2015-06-08
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:',d.get('Adam')
print 'Lisa:',d.get('Lisa')
print 'Bart:',d.get('Bart')
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:',d.get('Adam')
print 'Lisa:',d.get('Lisa')
print 'Bart:',d.get('Bart')
2015-06-08
廖老师好~
同学们请起立!!!
坐下^_^
---请问---
从这个小节往后都木有视频讲解吗?
还是正在制作更新中,,,
还是一些简单的内容,大家就通过文本自习叻?
---课程时间5小时0分---
是指这10章内容大概需要自习的时间,还是怎样?
下课~~~叮叮叮,,,请同学们起立!老师再见。。。
劳动委员去把大家热的饭盒取回,大家在教室吃吧~_~那个谁,不要抢女生的咸鸭蛋黄啊!
同学们请起立!!!
坐下^_^
---请问---
从这个小节往后都木有视频讲解吗?
还是正在制作更新中,,,
还是一些简单的内容,大家就通过文本自习叻?
---课程时间5小时0分---
是指这10章内容大概需要自习的时间,还是怎样?
下课~~~叮叮叮,,,请同学们起立!老师再见。。。
劳动委员去把大家热的饭盒取回,大家在教室吃吧~_~那个谁,不要抢女生的咸鸭蛋黄啊!
2015-06-08
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
sum=sum+x
print sum-50
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
sum=sum+x
print sum-50
2015-06-08
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key,':',d[key]
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key,':',d[key]
2015-06-08