sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if not x%2==0:
sum=sum+x
print sum
x = 0
while True:
x = x + 1
if x > 100:
break
if not x%2==0:
sum=sum+x
print sum
2015-08-02
sum = 0
x = 1
while True:
x = x + 1
if x > 100:
break
if not x%2==0:
sum=sum+x
print sum
x = 1
while True:
x = x + 1
if x > 100:
break
if not x%2==0:
sum=sum+x
print sum
2015-08-02
s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
t = set(L)
for a in s:
t.remove(a)
print t
L = ['Adam', 'Lisa', 'Bart', 'Paul']
t = set(L)
for a in s:
t.remove(a)
print t
2015-08-02
注意: Python代码的缩进规则。具有相同缩进的代码被视为代码块,上面的3,4行 print 语句就构成一个代码块(但不包括第5行的print)。如果 if 语句判断为 True,就会执行这个代码块。
缩进请严格按照Python的习惯写法:4个空格,不要使用Tab,更不要混合Tab和空格,否则很容易造成因为缩进引起的语法错误。
注意: if 语句后接表达式,然后用:表示代码块开始
缩进请严格按照Python的习惯写法:4个空格,不要使用Tab,更不要混合Tab和空格,否则很容易造成因为缩进引起的语法错误。
注意: if 语句后接表达式,然后用:表示代码块开始
2015-08-02
s = 'Python was started in 1989 by \"Guido\".'
print s
s = "Python is free and easy to learn."
print s
s = "Python was started in 1989 by \"Guido\"."
print s
print s
s = "Python is free and easy to learn."
print s
s = "Python was started in 1989 by \"Guido\"."
print s
2015-08-02
#input code
print("hello,python");
print 'hello,''python';
print("hello,python");
print 'hello,''python';
2015-08-02
最赞回答 / 小猫过河
1、int(‘123’,8)表示123是8进制,现在输出为十进制(int()函数默认十进制)的数,算法是,123倒置,3*8^0+2*8^1+1*8^2=83.2、注:^这个符号在这里表示平方3、更多信息请看这里:http://baike.baidu.com/view/883725.htm
2015-08-01
print L[0]
print L[1]
print L[2]
print L[2]或者
print L[0]
print L[0]
print L[1]
print L[2]
print L[1]
print L[2]
print L[2]或者
print L[0]
print L[0]
print L[1]
print L[2]
2015-08-01
L.pop(3)
L.pop(2)
print L或
L.pop(2)
L.pop(2)
print L
L.pop(2)
print L或
L.pop(2)
L.pop(2)
print L
2015-07-31
L = ['Adam', 'Lisa', 'Bart']
L.insert(2,'Paul')或
L.insert(-2,'Paul')
print L
L.insert(2,'Paul')或
L.insert(-2,'Paul')
print L
2015-07-31
L = [95.5, 85, 59]
print L[-1]
print L[-2]
print L[-3]
print L[-4]
这样也能过
print L[-1]
print L[-2]
print L[-3]
print L[-4]
这样也能过
2015-07-31
L = [95.5,85,59]
print L[0]
print L[0]
print L[1]
print L[2]
print L[0]
print L[0]
print L[1]
print L[2]
2015-07-31
L = ['Adam',95.5,'Lisa',85,'Bart',59]
print L
print L
2015-07-31
L=[]
for a in '123456789':
for b in '0123456789':
for c in '123456789':
if a==c:
L.append(a+b+c)
print L
for a in '123456789':
for b in '0123456789':
for c in '123456789':
if a==c:
L.append(a+b+c)
print L
2015-07-31