哪里有问题?
for x in [ '1','2','3','4','5','6','7','8','9' ]:
for y in [ '2','3','4','5','6','7','8','9']
if x > y:
break
else:
continue
print x + y
for x in [ '1','2','3','4','5','6','7','8','9' ]:
for y in [ '2','3','4','5','6','7','8','9']
if x > y:
break
else:
continue
print x + y
2019-08-23
a = list()
for x in [ '1', '2', '3', '4', '5', '6', '7', '8', '9']:
for y in [ '2', '3', '4', '5', '6', '7', '8', '9']:
if x > y:
a.append(x+y)
else:
continue
print [int(x) for x in a]
这是按照你的思路做出来的,不能直接print,因为,print不管放在那里都不能把他全部条件的弄出来,而且不管是break还是continue生效,最后的print 都不会去运行,这只是我的看法,我也是python萌新,说错了不要骂我啊,其实我python也不是很懂
举报