for x in [ 1, 2, 3, 4, 5, 6, 7, 8, 9]:
for y in [ 1, 2, 3, 4, 5, 6, 7, 8, 9,0 ]:
if x<y:
print '%d' %x+'%d' %y
for y in [ 1, 2, 3, 4, 5, 6, 7, 8, 9,0 ]:
if x<y:
print '%d' %x+'%d' %y
2016-12-06
# -*- coding: utf-8 -*-
print u'''
静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。
'''
这样写在linux运行不成功,但是在windows上可能运行成功(win10x64,python2.7.11亲测),具体情况还是不同的系统对代码的解析不太一样。
print u'''
静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。
'''
这样写在linux运行不成功,但是在windows上可能运行成功(win10x64,python2.7.11亲测),具体情况还是不同的系统对代码的解析不太一样。
2016-12-06
已采纳回答 / CekerLee
可能是Python GUI集成开发环境的编码默认是支持中文的,可以在这首行加上 # coding:utf-8 至于下面的提示是因为这个程序只检查你的答案是否与结果匹配。如图<...图片...>
2016-12-06
L.pop(2)
L.pop()
print L
或
L.pop(2)
L.pop(-1)
print L
或
L.pop(2)
L.pop(2)
print L
L.pop()
print L
或
L.pop(2)
L.pop(-1)
print L
或
L.pop(2)
L.pop(2)
print L
2016-12-06
最新回答 / 豪鬼
不要用d[i],用items() 来取d里面的key values = 88d={'ww':77,'aa':88}for k,v in d.items(): if v == s: print(k)
2016-12-06
total = 0
x = 0
while True:
if x <= 20:
total += pow(2, x-1)
x += 1
else:
break
print total
x = 0
while True:
if x <= 20:
total += pow(2, x-1)
x += 1
else:
break
print total
2016-12-06
我是不是有病?
for x in range(0,10):
for y in range(0,10):
if x<y:
L=10*x+y
if L<10:
continue
print L
for x in range(0,10):
for y in range(0,10):
if x<y:
L=10*x+y
if L<10:
continue
print L
2016-12-06
sum一定要是0.0,不能是0.
另外,如果不知道或者数不清列表的数量,是不是可以再加上一个计数的东西,比如 n+=1之类的。
另外,如果不知道或者数不清列表的数量,是不是可以再加上一个计数的东西,比如 n+=1之类的。
2016-12-06
def greet(x,y=1):
if x == y:
print("Hello World!")
else:
print("Hello,Girl!")
if x == y:
print("Hello World!")
else:
print("Hello,Girl!")
2016-12-05