因为在第一个if语句处,已然判断出20 >= 6,故第一句话执行完后,之后的语句将不再执行,所以不会打印adult
解决办法是:将第一个if语句条件修改为:if age >=6 and <=18:
或者是第一个if语句和第二个elif语句调换下顺序;
解决办法是:将第一个if语句条件修改为:if age >=6 and <=18:
或者是第一个if语句和第二个elif语句调换下顺序;
2015-06-27
if time <= 180 :
print '太快了吧!'
else :
print '还好,凑合!' #你懂得^-^
print '太快了吧!'
else :
print '还好,凑合!' #你懂得^-^
2015-06-27
a or "world" a为非空字符串所以表达式返回a
b or "world" b为空字符串所以表达式返回b
b or "world" b为空字符串所以表达式返回b
2015-06-26
def firstCharUpper(s):
return s[:1].upper()+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
return s[:1].upper()+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
2015-06-25
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
sum=sum+x
print sum
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
sum=sum+x
print sum
2015-06-25
sum = 0
x = 1
n = 1
while True:
x=2**(n-1)
sum=sum+x
n=n+1
if n>20:
break
print sum
x = 1
n = 1
while True:
x=2**(n-1)
sum=sum+x
n=n+1
if n>20:
break
print sum
2015-06-25