Write a function that reads stock share price at of N industries for M days as a two dimensional array and prints the diagonal price of the stock .
Question
Write a function that reads stock share price at of N industries for M days as a two dimensional array and prints the diagonal price of the stock .
🧐 Not the exact question you are looking for?Go ask a question
Solution 1
Sure, here is a Python function that does that:
def print_diagonal_prices(stock_prices):
# Get the length of the 2D array
n = len(stock_prices)
# Loop through the 2D array
for i in range(n):
# Print the diagonal element
print(stock_prices[i][i])
T Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.