这题的判定有BUG,使用下面代码也可以通过
sum = 0
x = 1
while x <= 100:
sum += x%2==1
x+=1
print sum
sum = 0
x = 1
while x <= 100:
sum += x%2==1
x+=1
print sum
2015-03-13
最赞回答 / qq_li_jian
<...code...>“那么如果在r'...'中使用了转义符号,就会被直接显示为\”,貌似是这样,但是如果字符串中有‘的话,不使用\仍然会报错,使用了就会显示\,,,那怎么办?
2015-03-13
最新回答 / 赞依旧
加引号就是字符串了 ,字符串和字符串,字符串和数字输出中间的'+'起到了连接作用;你这输出的就是 11 12 13。。。。你要输出两个数字相加之和就写成for x in [1,2,3,4,5,6,7,8,9]: for y in [1,2,3,4,5,6,7,8,9]: print x+y这样就输出了2,3,4,5。。。。
2015-03-13
but the true answer is below: (i don't think it's truth.)
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''
2015-03-13
like below:
print r''''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.' '''# <--space
I think should a space in the end.
print r''''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.' '''# <--space
I think should a space in the end.
2015-03-13
the answer should have ' ' use to bracket all string.
2015-03-13
已采纳回答 / a412739861
t不是一个只有1的数组,而是一个整数1。t=(1)相当于是进行了一次类似(2+2)的计算,或者看成(1+0)的一次计算。当一个数组只有一个值时,想让t是数组的形式存在,应该使用t=(1,)告诉机器,你输入的是只含有一个数值的数组,而非一个数字。
2015-03-12
print [x*100 + y*10 + z for x in range(10) for y in range(10) for z in range(10) if x > 0 and x == z]
2015-03-12