d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for i in d:
if d.get(i) == 95:
print i
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for i in d:
if d.get(i) == 95:
print i
2015-03-04
sum = 0
x = 1
while True:
if x > 100:
break
else:
sum +=x
x += 2
print sum
x = 1
while True:
if x > 100:
break
else:
sum +=x
x += 2
print sum
2015-03-04
sum = 0
x = 1
n = 1
while True:
sum+=x
x=2**n
n+=1
if n>20:
break
print sum
x = 1
n = 1
while True:
sum+=x
x=2**n
n+=1
if n>20:
break
print sum
2015-03-04
x = 1
d = 3
n=1
s=0
while n<= 100 :
s += x
x += d
n += 1
print s
d = 3
n=1
s=0
while n<= 100 :
s += x
x += d
n += 1
print s
2015-03-04
print('hello,python')
print('hello,python')
print('hello,python')
2015-03-04
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