## 逻辑推理、排列组合

2008年北京大学）排球单循环赛，南方球队比北方球队多9支，南方球队的总得分是北方球队的9倍。

## 其实，大部分人的高考数学，120也就顶天了

【金山文档】 88130零点
https://kdocs.cn/l/cdwJKlaAQ4U7

【金山文档】 88100极值
https://kdocs.cn/l/cgFVEpMg4FQ5

【金山文档】 88102极值
https://kdocs.cn/l/cq9mQfv7GTFC

## 一个质数

Start with 82 and go backwards to 1
8281807978777675747372717069686 7666564636261605958575655545352 5150494847464544434241403938373 6353433323130292827262524232221 2019181716151413121110987654321
…this number is prime!

## Python玩矩阵太方便了

``````X = [[12,7,3],
[4 ,5,6],
[7 ,8,9]]

Y = [[5,8,1],
[6,7,3],
[4,5,9]]

result = [[0,0,0],
[0,0,0],
[0,0,0]]

# 迭代输出行
for i in range(len(X)):
# 迭代输出列
for j in range(len(X[0])):
result[i][j] = X[i][j] + Y[i][j]

for r in result:
print(r)
``````

[17, 15, 4]
[10, 12, 9]
[11, 13, 18]

Fantastic!

## 最简单的类

``````class Province:

# 静态字段
country='中国'

# 直接访问静态字段
print(Province.country)``````

## 排序

9467
9245
1039
8765
3409
2857
2945
9720
8530
4828

i=0,min=2

i=1,min=5

i=2,min=6

i=3,min=4

i=4,min=9

i=5,min=8

i=6,min=9

i=7,min=8

i=8,min=9

1039
2857
2945
3409
4828
8530
8765
9245
9467
9720

``````if __name__ == "__main__":
N = 10
# input data
print ('请输入10个数字:\n')
l = []
for i in range(N):
l.append(int(input('输入一个数字:\n')))
print
for i in range(N):
print (l[i])
print

# 排列10个数字
for i in range(N - 1):
min = i
for j in range(i + 1,N):
if l[min] > l[j]:min = j
l[i],l[min] = l[min],l[i]
print("查看当前最小下标")
print("i=%d,min=%d"%(i,min))
print ('排列之后：')
for i in range(N):
print (l[i])
``````

## win10为什么输入python启动appstore

C:\Users\86135\AppData\Local\Programs\Python\Python311\

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

window环境变量path设置

path的各个值用冒号分开

set path=aa;%path% 是在原有环境变量前加上aa;

Thank youtuber: Tech with tim

How to Install Pygame (Windows 8/10) – YouTube

His teaching video is so easy to follow for 60-year-old beginner!

By the way, I hate installation.

## 求指定范围内的素数

``````lower = int(input("输入区间最小值: "))
upper = int(input("输入区间最大值: "))

for num in range(lower,upper + 1):
# 素数大于 1
if num > 1:
for i in range(2,num):
if (num % i) == 0:
break
else:
print(num)``````

28001
28019
28027
28031
28051
28057
28069
28081
28087
28097
28099
28109
28111
28123
28151
28163
28181
28183
28201
28211
28219
28229
28277
28279
28283
28289
28297
28307
28309
28319
28349
28351
28387
28393
28403
28409
28411
28429
28433
28439
28447
28463
28477
28493
28499
28513
28517
28537
28541
28547
28549
28559
28571
28573
28579
28591
28597
28603
28607
28619
28621
28627
28631
28643
28649
28657
28661
28663
28669
28687
28697
28703
28711
28723
28729
28751
28753
28759
28771
28789
28793
28807
28813
28817
28837
28843
28859
28867
28871
28879
28901
28909
28921
28927
28933
28949
28961
28979