print('hello,python')
print'hello,''python'
print'hello,''python'
2019-08-27
按照参考答案,会出现报错:
运行失败
Traceback (most recent call last):
File "index.py", line 8, in
低头思故乡。'''
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
如果把 u 去掉,可以正常运行。
运行失败
Traceback (most recent call last):
File "index.py", line 8, in
低头思故乡。'''
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
如果把 u 去掉,可以正常运行。
2019-08-27
1. if 后面跟的return要缩进
2. print '\n'.join('%s'% id for score in tds)
2. print '\n'.join('%s'% id for score in tds)
2019-08-26
已采纳回答 / qq_慕粉1563468
是因为python的版本问题,你看你的python是不是3.几版本的,教学这个是2.几版本,所以会不兼容。我下的是3.6版本,代码这样写就可以啦:print ('''静夜思窗前明月光,疑似地上霜。举头望明月,低头思故乡。''')加u就错误,第一行那个
# -*- coding: utf-8 -*-加不加都可以
2019-08-25
最赞回答 / Anastasia2019
‘’表示字符串,字符串不能比较大小;for……in 后面要加:修改如下,已测试可正常运行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: print x * 10 + y else: continue
2019-08-23
sum = 0
x = 1
while x < 100:
if x % 2 ==1:
sum += x
x = x + 1
print sum
x = 1
while x < 100:
if x % 2 ==1:
sum += x
x = x + 1
print sum
2019-08-23