1.定义标记变量:利用变量值的变化退出循环 # 第一种嵌套形式 a = [[1, 2, 3], [5, 5, 6], [7, 8, 9]] # init_i = 0 # init_j = 0 flag = True for i in range(3): for j in range(3): # print(i, j) if a[i][j] == 5: flag = False init_i = i init_j = j break if not flag: break print(init_i,…