最新回答 / MRLO
for k, v in d.items(): sum = sum + v print k,":",v print 'average', ':', sum/len(d)
2016-03-11
print 'python was started in 1989 by \"guido\".'
print 'python is free easy to learn.'
s = 'python was started in 1989 by \"guido\".'
t = 'python is free easy to learn.'
print s
print t
s = 'python was started in 1989 by \"guido\".\n python is free easy to learn.'
print s
print 'python is free easy to learn.'
s = 'python was started in 1989 by \"guido\".'
t = 'python is free easy to learn.'
print s
print t
s = 'python was started in 1989 by \"guido\".\n python is free easy to learn.'
print s
2016-03-11
def move(n, a, b, c):
if n==1:
print a,'-->',c
else:
move(n-1,a,c,b)
move(1,a,b,c)
move(n-1,b,a,c)
return
move(4, 'A', 'B', 'C')
if n==1:
print a,'-->',c
else:
move(n-1,a,c,b)
move(1,a,b,c)
move(n-1,b,a,c)
return
move(4, 'A', 'B', 'C')
2016-03-10
def move(n, a, b, c):
if n == 1:
print a," --> ",c
else :
print a," --> ",b
print a," --> ",c
return move(n-1, b, a, c)
move(4, 'A', 'B', 'C')
我的答案才是对的 推荐答案真奇怪
if n == 1:
print a," --> ",c
else :
print a," --> ",b
print a," --> ",c
return move(n-1, b, a, c)
move(4, 'A', 'B', 'C')
我的答案才是对的 推荐答案真奇怪
2016-03-10
def move(n,a,b,c):
if n==1:
return a,'-->',c
else:
return move(n-1,a,c,b),\
move(1,a,b,c),\
move(n-1,b,a,c)
#将n-1个盘从a移动到b,将底盘从a移动到c,最后将b盘上的n-1个盘再移动到c上
print move(3, 'A', 'B', 'C')
if n==1:
return a,'-->',c
else:
return move(n-1,a,c,b),\
move(1,a,b,c),\
move(n-1,b,a,c)
#将n-1个盘从a移动到b,将底盘从a移动到c,最后将b盘上的n-1个盘再移动到c上
print move(3, 'A', 'B', 'C')
2016-03-10
sum = 0
x = 1
while x<=100 and x%2 not =0:
sum+=x
print sum
x = 1
while x<=100 and x%2 not =0:
sum+=x
print sum
2016-03-10
L = ['Adam', 'Lisa', 'Bart']
L[0]= 'Bart'
L[-1]= 'Adam'
print L
L[0]= 'Bart'
L[-1]= 'Adam'
print L
2016-03-10
L = []
sum=0
x=1
while(1):
L.append(x*x)
x=x+1
if x>100:
break
for i in L:
sum=sum+i
print sum
sum=0
x=1
while(1):
L.append(x*x)
x=x+1
if x>100:
break
for i in L:
sum=sum+i
print sum
2016-03-10
import math
def quadratic_equation(a, b, c):
x=(-b+math.sqrt(b*b-4*a*c))/(2*a)
y=(-b-math.sqrt(b*b-4*a*c))/(2*a)
return x,y
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)
def quadratic_equation(a, b, c):
x=(-b+math.sqrt(b*b-4*a*c))/(2*a)
y=(-b-math.sqrt(b*b-4*a*c))/(2*a)
return x,y
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)
2016-03-10
L = []
x=1
while x<=100:
L.append(x**2)
x+=1
print sum(L)
x=1
while x<=100:
L.append(x**2)
x+=1
print sum(L)
2016-03-10