print [int(m+n+m) for m in'123456789' for n in'0123456789']
2019-06-18
sum = 0
x = 1
n = 1
while True:
sum=sum+x
x = x+1
n = x
if n > 20:
break
print sum
x = 1
n = 1
while True:
sum=sum+x
x = x+1
n = x
if n > 20:
break
print sum
2019-06-18
print L[0:10]
print L[2::3]
print L[4:50:5]
or
print L[0:10]
print L[2:100:3]
print L[4:50:5]
print L[2::3]
print L[4:50:5]
or
print L[0:10]
print L[2:100:3]
print L[4:50:5]
2019-06-17
安装python时,向导已经提醒是否要把Python.exe加入到path了,结果这视频直接忽略 默认了否...然后自己手动加... 真是天才
2019-06-16
x1 = 1
d = 3
n = 100
x100 = x1 + (n - 1) * d #第一百项 = 第一项 + (个数) * 递增的数值
s = (x1 + x100) * n / 2 #s = (第一项 + 第一百项) * 首末相加为一组,组数
print s
d = 3
n = 100
x100 = x1 + (n - 1) * d #第一百项 = 第一项 + (个数) * 递增的数值
s = (x1 + x100) * n / 2 #s = (第一项 + 第一百项) * 首末相加为一组,组数
print s
2019-06-15
sum = 0
n = 1
while True:
if n>20:
break
sum+=1<<(n-1)
n=n+1
print sum
n = 1
while True:
if n>20:
break
sum+=1<<(n-1)
n=n+1
print sum
2019-06-15
sum = 0
n = 1
while True:
if n<=20:
sum+=1<<(n-1)
n=n+1
else:
break
print sum
n = 1
while True:
if n<=20:
sum+=1<<(n-1)
n=n+1
else:
break
print sum
2019-06-15
def square_of_sum(L):
return sum(i * i for i in L)
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
return sum(i * i for i in L)
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
2019-06-14
def square_of_sum(L):
sum=0
for i in L:
sum+=i*i
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
sum=0
for i in L:
sum+=i*i
return sum
print square_of_sum([1, 2, 3, 4, 5])
print square_of_sum([-5, 0, 5, 15, 25])
2019-06-14
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+y
for y in[ '0','1','2','3','4','5','6','7','8','9']:
if x<y:
print x+y
2019-06-14
sum = 0
x = 0
while True:
x = x + 1
if x%2==0:
continue
if x > 100:
break
sum=sum+x
print sum
x = 0
while True:
x = x + 1
if x%2==0:
continue
if x > 100:
break
sum=sum+x
print sum
2019-06-14