不是说 类似的,如果字符串包含",我们就可以用' '括起来表示:'Learn "Python" in imooc',所以答案那个斜杠不在也没关系吧
2015-03-25
这个是正确的,上面的看了半天都搞晕了
#coding:utf-8
def move(n, a, b, c):
if n ==1:
print(a, '-->', c)
return
print (a,'-->',b)
move(n-1, a, b, c)
print (b,'-->',c)
move(4, 'A', 'B', 'C')
#coding:utf-8
def move(n, a, b, c):
if n ==1:
print(a, '-->', c)
return
print (a,'-->',b)
move(n-1, a, b, c)
print (b,'-->',c)
move(4, 'A', 'B', 'C')
2015-03-25
score = 55
if score>=60:
print '还行吧,再接再厉!'
else:
print '我去,又挂了!'
if score>=60:
print '还行吧,再接再厉!'
else:
print '我去,又挂了!'
2015-03-25
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
elif x % 2 ==0:
continue
sum = sum + x
print sum
x = 0
while True:
x = x + 1
if x > 100:
break
elif x % 2 ==0:
continue
sum = sum + x
print sum
2015-03-24
s = set([('Adam', 95), ('Lisa', 85), ('Bart', 59)])
for x in s:
print x[0] + ':' + str(x[1])
#or# print " %s: %s" %x
for x in s:
print x[0] + ':' + str(x[1])
#or# print " %s: %s" %x
2015-03-24
months = set(['jan','Feb'])
x1 = 'Feb'
x2 = 'Sun'
if x1 in months:
print 'x1: ok'
else:
print 'x1: error'
if x2 in months:
print 'x2: ok'
else:
print 'x2: error'
x1 = 'Feb'
x2 = 'Sun'
if x1 in months:
print 'x1: ok'
else:
print 'x1: error'
if x2 in months:
print 'x2: ok'
else:
print 'x2: error'
2015-03-24
s = set(['adam','bart'])
print 'adam' in s
print 'bart' in s
print 'adam' in s
print 'bart' in s
2015-03-24
s = set(['Adam','Lisa','Bart','Paul'])
print s
print s
2015-03-24