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
2015-03-04
sum=0
for x in range(0,101):
if x%2==0:
continue
sum=sum+x
print sum
for x in range(0,101):
if x%2==0:
continue
sum=sum+x
print sum
2015-03-04
print 45678+0x12fd2 :ok
print (45678+0x12fd2) :ok
print hex(45678)+0x12fd2 :#type error! hex()是字符串类型,不能与十六进制的数据进行直接相加
print (45678+0x12fd2) :ok
print hex(45678)+0x12fd2 :#type error! hex()是字符串类型,不能与十六进制的数据进行直接相加
2015-03-03
# -*- coding: utf-8 -*-
sum = 0
x = 0
while x <= 99:
x += 1
if x % 2 == 0:
continue
sum += x
print sum
sum = 0
x = 0
while x <= 99:
x += 1
if x % 2 == 0:
continue
sum += x
print sum
2015-03-03
s = set(['Adam', 'Paul']) 'Lisa' is not exist in set
2015-03-03
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key+':'+str(d[key])
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key+':'+str(d[key])
2015-03-03
for x in range(1,9):
for y in range(2,10):
if x<y:
print x*10+y
for y in range(2,10):
if x<y:
print x*10+y
2015-03-02
#coding:utf-8
def move(n, a, b, c):
if n ==1:
print a, '-->', c
else:
move(n-1, a, c, b) #将前n-1个从A移动到B
print a, '-->', c #将第n个从A移动到C
move(n-1, b, a, c) #将前n-1个从B移动到C
def move(n, a, b, c):
if n ==1:
print a, '-->', c
else:
move(n-1, a, c, b) #将前n-1个从A移动到B
print a, '-->', c #将第n个从A移动到C
move(n-1, b, a, c) #将前n-1个从B移动到C
2015-03-02