def move(n, a, b, c):
if n == 1:
print a, '-->', c
return
move(n - 1, a, c, b)
print a, '-->', c
move(n - 1, b, a, c)
move(4, 'a', 'b', 'c')
if n == 1:
print a, '-->', c
return
move(n - 1, a, c, b)
print a, '-->', c
move(n - 1, b, a, c)
move(4, 'a', 'b', 'c')
2020-01-04
x1 = 1
d = 3
n = 100
x100 = x1+(n-1)*d
s = (x1+x100)*100/2
print s
d = 3
n = 100
x100 = x1+(n-1)*d
s = (x1+x100)*100/2
print s
2020-01-03
for x in range(1, 10):
for y in range(1, 10):
if x < y: print(x * 10 + y)
for y in range(1, 10):
if x < y: print(x * 10 + y)
2020-01-03
sum = 0
x = 1
n = 1
while True:
if n > 20: break
sum += x
x *= 2
n +=1
print sum
x = 1
n = 1
while True:
if n > 20: break
sum += x
x *= 2
n +=1
print sum
2020-01-03
sum = 0
x = 1
while x<100:
if x%2==1:
sum =sum +x
x=x+1
print sum
x = 1
while x<100:
if x%2==1:
sum =sum +x
x=x+1
print sum
2020-01-03
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)
2020-01-02
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for x in L:
if x in s:
s.remove(x)
else:
s.add(x)
print s
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for x in L:
if x in s:
s.remove(x)
else:
s.add(x)
print s
2020-01-02