L= ["A","B","c","D"]
L.pop(2)
L.pop(2)
print L
L.pop(2)
L.pop(2)
print L
2018-08-18
sum = 0
x = 1
while x < 100:
sum = sum + x * (x/2)
print sum
x = 1
while x < 100:
sum = sum + x * (x/2)
print sum
2018-08-17
def average(*args):
if len(args)==0 :
return 0.0
else:
n = len(args) * 1.0
return sum(args)/n
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
if len(args)==0 :
return 0.0
else:
n = len(args) * 1.0
return sum(args)/n
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2018-08-17
age = 8
if age >= 18
print 'adult'
elif age >= 6:
print 'teenager'
else:
print 'kid'
if age >= 18
print 'adult'
elif age >= 6:
print 'teenager'
else:
print 'kid'
2018-08-17
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.'''
2018-08-17
x1 = 1
d = 3
n = 100
x100 = x1+(n-1)*d
s = n*(x1+x100)/2
print s
d = 3
n = 100
x100 = x1+(n-1)*d
s = n*(x1+x100)/2
print s
2018-08-16
print'hello,python'
print 'hello,','python'
print 'hello,','python'
2018-08-16
print 45678+0x12fd2
print 'Learn Python in imooc'
print 100<99
print 0xff==255
print 'Learn Python in imooc'
print 100<99
print 0xff==255
2018-08-16
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.'''
2018-08-15
sum = 0
x = 1
n = 1
while True:
sum += x;
x=x<<1;
if n==20:
break;
n+=1;
print sum;
x = 1
n = 1
while True:
sum += x;
x=x<<1;
if n==20:
break;
n+=1;
print sum;
2018-08-15