我是不是写的最复杂的一个 - -
print [int(str(a) +str(b) + str(c)) for a in range(1,10) for b in range (0,10) for c in range(0,10) if cmp(str(a) +str(b) + str(c),str(c) +str(b) + str(a)) == 0]
print [int(str(a) +str(b) + str(c)) for a in range(1,10) for b in range (0,10) for c in range(0,10) if cmp(str(a) +str(b) + str(c),str(c) +str(b) + str(a)) == 0]
2018-05-05
L = [75, 92, 59, 68]
sum = 0.0
for x in L:
sum += x
print sum / 4
sum = 0.0
for x in L:
sum += x
print sum / 4
2018-05-04
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
i=0.0
sum = 0.0
for i in d.values():
sum = sum + i
sum = sum / 4
print sum
i=0.0
sum = 0.0
for i in d.values():
sum = sum + i
sum = sum / 4
print sum
2018-05-04
sum = 0
x = 1
while x<100:
sum = sum + x
x = x+2
print sum
x = 1
while x<100:
sum = sum + x
x = x+2
print sum
2018-05-04
那位说别人装X的大哥,题目哪里说是100内的了???
题目说的是前100项的和,所以x1到x100就是100个变量。
你说的34是变量值小于100的数有34个,脑子不好眼睛也不好使?
题目说的是前100项的和,所以x1到x100就是100个变量。
你说的34是变量值小于100的数有34个,脑子不好眼睛也不好使?
2018-05-04