print "方法一"
for i in range(1,101)[6::7]:
print i
print "方法二"
for i in range(1,101):
if i%7==0:
print i
for i in range(1,101)[6::7]:
print i
print "方法二"
for i in range(1,101):
if i%7==0:
print i
L = range(1, 101)
print L[:10]
print L[2:100:3]
print L[4:50:5]
print L[:10]
print L[2:100:3]
print L[4:50:5]
2015-07-07
def cal(m):
s=0
n=m
while True:
s=s+n*n
n=n+1
if n>100:
break
else:
pass
print s
cal(1)
s=0
n=m
while True:
s=s+n*n
n=n+1
if n>100:
break
else:
pass
print s
cal(1)
2015-07-06
L = ['Adam', 'Lisa', 'Bart']
L[0]=L[-1]
L[2]='Adam'
print L
L[0]=L[-1]
L[2]='Adam'
print L
2015-07-06
d = {
'Adam':95,
'Lisa':85,
'Bart':59,
'Paul':75,
}
'Adam':95,
'Lisa':85,
'Bart':59,
'Paul':75,
}
2015-07-05
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop(2)
L.pop()
print L
L.pop(2)
L.pop()
print L
2015-07-05
print [int(x+y+z) for x in '123456789' for y in '0123456789' for z in'0123456789' if x==z]
2015-07-04
print "hello,python"
print 'hello,','python'
print 'hello,'+'python'
加号编译也通过
print 'hello,','python'
print 'hello,'+'python'
加号编译也通过
2015-07-02
for x in range(10):
for y in range(10):
if x<y and x >=1:
print(x*10 + y)
for y in range(10):
if x<y and x >=1:
print(x*10 + y)
2015-07-02