这个不对?输入显示:IndentationError: expected an indented block?? 还有如果不输入【list】这个括号就是错误而无序的吗
months = set(["Feb","Jau","Mar","Apr","May"]) x = "monday" if x in months: print "x: ok" else: print "x:error"
months = set(["Feb","Jau","Mar","Apr","May"]) x = "monday" if x in months: print "x: ok" else: print "x:error"
2016-07-12
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''
print '\"To be, or not to be\": that is the question.\nWhether it\'s nobler in the mind to suffer.'
Whether it's nobler in the mind to suffer.'''
print '\"To be, or not to be\": that is the question.\nWhether it\'s nobler in the mind to suffer.'
2016-07-12
s = 'Python was started in 1989 by "Guido".\nPython is free and easy to learn.'
print s
print s
2016-07-12
print('hello,python')
print('hello,'+'python')
print 'hello,python'
print 'hello,','python'
输出
hello,python
hello,python
hello,python
hello, python 相对而言,第二种方法多出了一个空格
print('hello,'+'python')
print 'hello,python'
print 'hello,','python'
输出
hello,python
hello,python
hello,python
hello, python 相对而言,第二种方法多出了一个空格
2016-07-12
for x in range(1,10):
for y in range(0,10):
if x < y:
print x*10+y
#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 range(0,10):
if x < y:
print x*10+y
#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
2016-07-12
print r'''"To be,or not to be":that is the question.
Whether it's nobler in the mind to suffer.'''
终于对了,分享一下
Whether it's nobler in the mind to suffer.'''
终于对了,分享一下
2016-07-12
s = 'Python was started in 1989 by \"Guido\".\nPython in free and easy to learn.'
这样写怎么就不对了。。。
这样写怎么就不对了。。。
2016-07-12
最新回答 / livebetter
变量间复制,可变对象是引用,不可变是值copy(新生成值空间,不是变量对象空间).建议阅读链接:http://blog.csdn.net/longshenlmj/article/details/13773977
2016-07-12
已采纳回答 / mosso
sum =0x = 0while True: x = x + 1 if x%2==0: continue sum = sum +x if x>100: breakprint sum你把 if x>100:放在后面当x=101后程序已经执行了求和,在来执行判断。所以多加了101.
2016-07-12