L = range(1, 101)
L1 =[]
L2=[]
print L[0:10]
for x in L:
if x%3==0:
L1.append(x)
print L1
for y in L:
if y<=50 and y%5==0:
L2.append(y)
print L2
print L[2::3]
print L[4:50:5]
L1 =[]
L2=[]
print L[0:10]
for x in L:
if x%3==0:
L1.append(x)
print L1
for y in L:
if y<=50 and y%5==0:
L2.append(y)
print L2
print L[2::3]
print L[4:50:5]
2020-07-03
# -*- coding: utf-8 -*-
d = {
95 :'Adam',
85 :'Lisa',
59 :'Bart'
}
for key in [95,85,59]:
if key ==95:
print "95分的同学是: %s"%(d[key])
elif key ==85:
print "85分的同学是: %s"%(d[key])
else:
print "59分的同学是: %s"%(d[key])
d = {
95 :'Adam',
85 :'Lisa',
59 :'Bart'
}
for key in [95,85,59]:
if key ==95:
print "95分的同学是: %s"%(d[key])
elif key ==85:
print "85分的同学是: %s"%(d[key])
else:
print "59分的同学是: %s"%(d[key])
2020-07-03
def firstCharUpper(s):
return s.title()
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
return s.title()
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
2020-07-02
# -*- coding: utf-8 -*-
print r'''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
print r'''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
2020-06-28
L =[x for x in range(1,101)]
Sum =0
for v in L:
Sum +=v*v
print(L)
print(Sum)
Sum =0
for v in L:
Sum +=v*v
print(L)
print(Sum)
2020-06-27
My answer
print "hello,python"
print "hellp","python"
print "hello,python"
print "hellp","python"
2020-06-24
My answer:
print (45678+0x12fd2)
print "Learn Python in imooc"
print(100<99)
print(0xff==255)
print (45678+0x12fd2)
print "Learn Python in imooc"
print(100<99)
print(0xff==255)
2020-06-24
for x in [2,3,4,5,6,7,8,9]:
for y in range(1,x):
print(y*10+x)
这样也可以实现啊 ,为什么不对??
for y in range(1,x):
print(y*10+x)
这样也可以实现啊 ,为什么不对??
2020-06-22