for x in range(1,10):
for y in range(0,10):
if x<y:
print x*10 +y
for y in range(0,10):
if x<y:
print x*10 +y
2015-09-23
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
else:
sum += x
print sum
#或者不使用continue
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2:
sum += x
print sum
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
else:
sum += x
print sum
#或者不使用continue
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2:
sum += x
print sum
2015-09-23
sum = 0
x = 1
while x<100:
if x%2==0:
continue
sum = sum + x
x = x + 1
print sum
这么写有什么错吗?怎么老是报错
x = 1
while x<100:
if x%2==0:
continue
sum = sum + x
x = x + 1
print sum
这么写有什么错吗?怎么老是报错
2015-09-23
print [100*a+10*b+c for a in range(1,10) for b in range(0,10) for c in range(0,10) if a==c]
2015-09-22
s = set([('Adam', 95), ('Lisa', 85), ('Bart', 59)])
for x in s:
print x[0],':',x[1]
for x in s:
print x[0],':',x[1]
2015-09-22
sum = 0
x = 1
while True:
if x % 2:
sum = sum + x
x = x + 1
if x > 100:
break
print sum
x = 1
while True:
if x % 2:
sum = sum + x
x = x + 1
if x > 100:
break
print sum
2015-09-21
sum = 0
x = 1
n = 1
while True:
sum = sum + x
x = 2*x
n = n + 1
if n > 20:
break
print sum
x = 1
n = 1
while True:
sum = sum + x
x = 2*x
n = n + 1
if n > 20:
break
print sum
2015-09-21
i = 1
j = 2
while i < 10:
j = 2
while j < 10:
if i < j:
print i * 10 + j
j += 1
i += 1
j = 2
while i < 10:
j = 2
while j < 10:
if i < j:
print i * 10 + j
j += 1
i += 1
2015-09-21