6.(1) 编程:将列表的元素按逆序重新存放。def reverseList(list): list.reverse() return list(2) 编程:将列表中的偶数变成其平方值,奇数保持不变。def squareEvenNumber(list): for i in range(len(list)): if list[i] % 2 == 0: list[i] = list[i] * list[i] return list(3) 编程:生成包含100个100以内的随机正整数的元组,统计每个数出现的次数。import randomdef countRandom(): nums = tuple(random.randint(0,100) for i in range(100)) count = {} for i in nums: if i not in count: count[i] = 1 else: count[i] += 1 return count(4) 编程:输入5 X 5 的矩阵a,完成下列要求:a. 输出矩阵ab. 将第2行和第5行元素对调后,再重新输出adef matrixChange(matrix): row_2 = matrix[1] row_5 = matrix[4] matrix[1] = row_5 matrix[4] = row_2 return matrixmatrix = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]print('输出矩阵a:')for row in matrix: for col in row: print(col, end=' ') print()matrix = matrixChange(matrix)print('将第2行和第5行元素对调后,再重新输出a:')for row in matrix: for col in row: print(col, end=' ') print()7.(1)week_dict = {"Monday": 1, "Tuesday": 2, "Wednesday": 3, "Thursday": 4, "Friday": 5, "Saturday": 6, "Sunday": 7}keys = list(week_dict.keys())values = list(week_dict.values())key_values = list(week_dict.items())print(keys)print(values)print(key_values)(2)student_dict = {}total = 0lowest = 11highest = 0for i in range(10): name = input("Please enter the student's name: ") score = int(input("Please enter the student's score: ")) student_dict[name] = score total += score if score < lowest: lowest = score if score > highest: highest = scoreprint("The highest score is", highest)print("The lowest score is", lowest)(3)import randomA = set()B = set()for i in range(10): A.add(random.randint(0, 10)) B.add(random.randint(0, 10))print("The set A is", A)print("The set B is", B)print("The length of A is", len(A))print("The length of B is", len(B))print("The union of A and B is", A | B)print("The intersection of A and B is", A & B)print("The difference of A and B is", A - B)