L = [95.5, 85, 59]
print [-1]
print [-2]
print [-3]
我这样都能过的咯
print [-1]
print [-2]
print [-3]
我这样都能过的咯
2018-06-13
Python 3的语法,如提示需要加上括号:
>>> print("Hello world")
>>> print("Hello world")
2018-06-13
for x in [ 1,2,3,4,5,6,7,8 ]:
for y in [ 2,3,4,5,6,7,8,9 ]:
if x >= y:
continue
print x*10 + y
for y in [ 2,3,4,5,6,7,8,9 ]:
if x >= y:
continue
print x*10 + y
2018-06-13
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key,value in d.items():
print key,':',value
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key,value in d.items():
print key,':',value
2018-06-13
sum = 0
x = 1
n = 1
while True:
sum += x
x = x*2
if n >= 20:
break
n += 1
print sum
x = 1
n = 1
while True:
sum += x
x = x*2
if n >= 20:
break
n += 1
print sum
2018-06-13
import math
sum = 0
x = 1
n = 1
while True:
x=math.pow(2,(n-1));
sum=sum+x;
n = n+1;
if n > 20:
break;
print sum
sum = 0
x = 1
n = 1
while True:
x=math.pow(2,(n-1));
sum=sum+x;
n = n+1;
if n > 20:
break;
print sum
2018-06-12
x1 = 1
d = 3
n = 100
s=x1
while n>1:
x1=x1+d
s+=x1
n=n-1
print(s)
d = 3
n = 100
s=x1
while n>1:
x1=x1+d
s+=x1
n=n-1
print(s)
2018-06-12
print 'hello','python'
print 'hello,python'
print 'hello,python'
2018-06-11
sum = 0
x = 1
n = 1
while True:
sum=sum+2**(n-1)
n=n+1
if n>20:
break
print sum
x = 1
n = 1
while True:
sum=sum+2**(n-1)
n=n+1
if n>20:
break
print sum
2018-06-10
不小心敲成这样了
L = [95.5, 85, 59]
print L[-1]
print [-2]
print L[-3]
竟然能过!!!!!!
L = [95.5, 85, 59]
print L[-1]
print [-2]
print L[-3]
竟然能过!!!!!!
2018-06-10
def greet(X):
n=len(X)
if n>0:
print('hello',X)
return
else:
print('hello,word')
return
greet('bart')
n=len(X)
if n>0:
print('hello',X)
return
else:
print('hello,word')
return
greet('bart')
2018-06-10