Westonci.ca offers quick and accurate answers to your questions. Join our community and get the insights you need today. Get accurate and detailed answers to your questions from a dedicated community of experts on our Q&A platform. Get immediate and reliable solutions to your questions from a community of experienced professionals on our platform.

Python Activity

We pass in a 2 dimensional list. You should output the 3rd element of the 2nd row.
--------------------------------------
Requirements:
Program Output
Program Failed for Input: "" 1,2,4 ""
Expected Output: 4
--------------------------------------
Given code:
# Get our list from the command line arguments
import sys
list2d= sys.argv[1:]
# Convert the command line arguments into 2d list
for i in range(0,len(list2d)):
list2d[i]= list2d[i].split(',')
# Write your code below


Sagot :

The code for output the 3rd element of the 2nd row in python is print(list2d[1][2])

The complete code in python is,

# Get our list from the command line arguments

import sys

list2d= sys.argv[1:]

# Convert the command line arguments into 2d list

for i in range(0,len(list2d)):

list2d[i]= list2d[i].split(',')

# Write your code below

print(list2d[1][2])

The print function will display the output.

Then the first parameter in list2d is to indicate the row (as usual the index start from 0, so the 2nd row is 1) and the second parameter in list2d is to indicate the element (index also start from 0, so the 3rd element is 2).

Learn more about python here:

brainly.com/question/26497128

#SPJ4