用Python语言补全以下代码:8、* 下载由正整数组成的数据文件{<wj011. txt>}到自己的计算机中,编写程序,对该数据文件里的前600个数从小到大排序,求出第1到第500个数中大于1000的偶数的个数。把结果写入试卷中指定位置。 请填空: s=[] n=0 with open("F:\\ data files\\wj011. txt"," rt") as fp: str=fp. readlines() st=str(st)[2:-2] for i in .( ): n=n+1 x=int( i) s. append(x) if >=600: ( ) = for i in range(500): if s[i]>1000 and s[i]%2==0: n=n+1 else: print (n)
时间: 2023-06-26 18:03:56 浏览: 125
s=[]
n=0
with open("F:\\ data files\\wj011. txt","rt") as fp:
str=fp. readlines()
st=str(st)[2:-2]
for i in str.split(","):
n=n+1
x=int(i)
s. append(x)
if n>=600:
s = sorted(s[:600])
for i in range(500):
if s[i]>1000 and s[i]%2==0:
n=n+1
print(n)