print [int(str(a)+str(b)+str(c)) for a in range(1,10) for b in range(0,10) for c in range(1,10) if a == c]
2018-10-24
s = set (['Adam','Lisa','Bart','Paul'])
print ('adam'.capitalize() in s)
print ('bart'.capitalize() in s)
print ('adam'.capitalize() in s)
print ('bart'.capitalize() in s)
2018-10-23
L = ['Adam', 'Lisa', 'Bart']
L.insert(0,L.pop())
L.insert(1,L.pop())
print L
L.insert(0,L.pop())
L.insert(1,L.pop())
print L
2018-10-22
s = 'Python was started in 1989 by "Guido".\nPython is free and easy to learn.'
print (s)
print (s)
2018-10-21
x1 = 1
d = 3
n = 100
x100 = x1 + (n-1)*d
s = (x1 + x100)*n/2
print s
d = 3
n = 100
x100 = x1 + (n-1)*d
s = (x1 + x100)*n/2
print s
2018-10-21
x1 = 1
d= 4
n = 1
while True:
x1 = x1 + d
d = d+3
n = n+1
if n>99:
break
print(x1)
d= 4
n = 1
while True:
x1 = x1 + d
d = d+3
n = n+1
if n>99:
break
print(x1)
2018-10-21
int()函数的第二个参数是转换进制,如果不传,默认是十进制 (base=10),如果传了,就用传入的参数。 这个说法是不对吧,int('12',8)结果是10说明int里的参数,第一个是数,第二个是进制,得的结果是十进制的值,如int('1010'2)结果是十进制的10
2018-10-19