s = 1+4+7+10+...+(1+3*99)
= 100+3+6+9+...+3*99
= 100+3*1+3*2+3*3+...+3*99
= 100+3*(1+99)*49+3*50
= 100+14700+150
= 14950
= 100+3+6+9+...+3*99
= 100+3*1+3*2+3*3+...+3*99
= 100+3*(1+99)*49+3*50
= 100+14700+150
= 14950
2016-01-07
L = ['Adam', 'Lisa', 'Bart']
L.insert(2,'Paul')
print L
L.insert(2,'Paul')
print L
2016-01-07
a = 'python'
print 'hello,', a or 'world'
# hello,'python'
b = ''
print 'hello,', b or 'world'
# hello world
print 'hello,', a or 'world'
# hello,'python'
b = ''
print 'hello,', b or 'world'
# hello world
2016-01-07
print r'''"To be, or not to be":that is the question.
Whether it's nobler in the mind to suffer.'''
Whether it's nobler in the mind to suffer.'''
2016-01-07
L = ['Adam', 'Lisa', 'Bart']
L[0] = 'Bart'
L[-1]= 'Adam'
print L
L[0] = 'Bart'
L[-1]= 'Adam'
print L
2016-01-07
x1 = 1
d = 3
n = 100
x100 = x1 + (100-1)*3
s = (x1 + x100)*n/2
print s
d = 3
n = 100
x100 = x1 + (100-1)*3
s = (x1 + x100)*n/2
print s
2016-01-07
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop(2)
L.pop(2)
print (L)
L.pop(2)
L.pop(2)
print (L)
2016-01-07
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop()
L.pop()
print L
L.pop()
L.pop()
print L
2016-01-07
print'hello,python'
print'hello,','python'
print'hello,','python'
2016-01-07
print'45678 + 0x12fd2=',45678 + 0x12fd2
print'Learn Python in imooc'
print 100 < 99
print 0xff == 255
print'Learn Python in imooc'
print 100 < 99
print 0xff == 255
2016-01-07
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for t in d.itervalues():
sum += t
print sum/len(d)
sum = 0.0
for t in d.itervalues():
sum += t
print sum/len(d)
2016-01-07
print [m*100 + n *10 + m for m in range(1,10) for n in range(10)]
2016-01-06