- Rewrite The Following Code To Use Two While Loops In Place Of The Two For Loops Def Sum Upper Triangle Matrix Sum Val 1 (33.57 KiB) Viewed 19 times
Rewrite the following code to use two while loops in place of the two for loops: def sum_upper_triangle(matrix): sum_val
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Rewrite the following code to use two while loops in place of the two for loops: def sum_upper_triangle(matrix): sum_val
Rewrite the following code to use two while loops in place of the two for loops: def sum_upper_triangle(matrix): sum_val = 0 for i in range (len(matrix)): for j in range(i, len(matrix)): sum_val += matrix[j] return sum_val