我们需要将python路径加入path中。右键单击 【计算机】,选择菜单属性命令,在弹出的对话框中选择 【高级系统设置】 标签,选择 高级 标签,然后点击 环境变量 按钮。选中【系统变量】中的“path”选项,单击【编辑】按钮,将弹出如下图所示的对话框。在【变量值】文本框中的末尾添加“;C:\Python27”(这里是你的安装路径),单击【确定】按钮。
2016-05-06
sum = 0
x = 1
n = 1
while True:
x=2**(n-1)
sum=sum+x
n=n+1
if n>20:
break
print sum
总觉得这样没错,然而不能通过,只能改为了它提供的那种。
x = 1
n = 1
while True:
x=2**(n-1)
sum=sum+x
n=n+1
if n>20:
break
print sum
总觉得这样没错,然而不能通过,只能改为了它提供的那种。
2016-05-06
def move(n, source, bridge, destination):
if n == 1:
print source, '-->', destination
else:
move(n-1,source, destination, bridge)
print source, '-->', destination
move(n-1, bridge, source, destination)
if n == 1:
print source, '-->', destination
else:
move(n-1,source, destination, bridge)
print source, '-->', destination
move(n-1, bridge, source, destination)
2016-05-06
sum = 0
x = 1
while True:
sum += x%2 and x
x = x + 1
if x > 100:
break
print sum
x = 1
while True:
sum += x%2 and x
x = x + 1
if x > 100:
break
print sum
2016-05-06
if a == 0:
return "wujie"
delta = b ** 2 - 4 * a * c
if delta < 0:
return "wujie"
elif delta == 0:
x = -b / (2 * a)
return "only:",x
elif delta > 0:
x1 = (-b + math.sqrt(delta)) / (2 * a)
x2 = (-b - math.sqrt(delta)) / (2 * a)
return x1, x2
return "wujie"
delta = b ** 2 - 4 * a * c
if delta < 0:
return "wujie"
elif delta == 0:
x = -b / (2 * a)
return "only:",x
elif delta > 0:
x1 = (-b + math.sqrt(delta)) / (2 * a)
x2 = (-b - math.sqrt(delta)) / (2 * a)
return x1, x2
2016-05-06
for x in [1,2,3,4,5,6,7,8,9]:
for y in [0,1,2,3,4,5,6,7,8,9]:
if x<y:
print x*10+y
完全看不出来自己哪里错了啊
for y in [0,1,2,3,4,5,6,7,8,9]:
if x<y:
print x*10+y
完全看不出来自己哪里错了啊
2016-05-06
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
else:
if x%2 !=0:
sum+=x
else:
continue
print sum
x = 0
while True:
x = x + 1
if x > 100:
break
else:
if x%2 !=0:
sum+=x
else:
continue
print sum
2016-05-06