L = [5,9] ;
def area_of_circle(x):
return 3.14*x*x
for a in L:
s = area_of_circle(a)
print s
def area_of_circle(x):
return 3.14*x*x
for a in L:
s = area_of_circle(a)
print s
2019-07-03
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key,d[key]
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key,d[key]
2019-07-03
for x in range(1,10):
for y in range(0,10):
if x>y:
print str(x)+str(y)
for y in range(0,10):
if x>y:
print str(x)+str(y)
2019-07-03
a or 'world',a是True,所以直接返回a;b or 'world',b是空,所以是False,因为world是True,所以返回world
2019-07-03
L = ['Adam', 'Lisa', 'Bart']
L.reverse()
print L
L.reverse()
print L
2019-07-03
L = ['Adam', 'Lisa', 'Bart']
B = L
L = []
n = 0
for i in B:
n -=1
L.append(B[n])
print L
B = L
L = []
n = 0
for i in B:
n -=1
L.append(B[n])
print L
2019-07-03