选择题
1-10: a a a b a a b bc abd abcd
填空题
11、数组或列表 12、大数据方面的科学计算、数据可视化模块 13、while语句、for语句 14、PyPDF2、NLTK 、Python-docx 15、Python2、Python3 16、# 17、| 18、read_csv()、read_table() 19、对齐 20、5
问答题
21、 size=steps)# 当元素为1时,direction_steps为1,# 当元素为0时,direction_steps 为-1direction_steps = np.where(draws > 0, 1, -1)# 使用cumsum()计算步数累计和distance = direction_steps.cumsum()# 使用max()计算向前走的最远距离distance.max()# 使用min()计算向 后走的最远距离distance.min()# 15米换算成步数steps = 15/0.5(np.abs(distance) >= steps).argmax()
22、 f = open("D:/python/data.csv","r",encoding="UTF-8")lines = f.readlines()lines.reverse()for line in lines: line=line.replace("\n"," ") lt = line.split(',') lt.reverse() ans = ';'.join(lt) print(ans.replace(" ",""))f.close()
23、 f=open("D:/python/score.csv")ls=[]for line in f: line = line.replace("\n","") ls.append(line.split(","))print(ls)ls[0].append('总分')for i in range(len(ls)-1): sum1 = 0 for j in range(len(ls[i+1])): if ls[i+1][j].isnumeric(): sum1 = sum1 + int(ls[i+1][j]) ls[i+1].append(str(sum1))print(ls)file_new = open("D:/python/newdata.csv","w")for line in ls: file_new.write(",".join(line)+"\n")f.close()file_new.close()
24、 "#Python数据分析\n", "##Python数据分析\n", "###Python数据分析\n", "Python数据分析 \n", "Python数据分析\n", "_Python数据分析_\n"