A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a Python program to extract every first or specified element from a given two-dimensional list
Q:

Write a Python program to extract every first or specified element from a given two-dimensional list

0

Write a Python program to extract every first or specified element from a given two-dimensional list

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def specified_element(nums, N):
    result = [i[N] for i in nums]
    return result
    
nums = [
        [1,2,3,2],
        [4,5,6,2],
        [7,1,9,5],
       ]
    
print("Original list of lists:")
print(nums)
N = 0
print("\nExtract every first element from the said given two dimensional list:")
print(specified_element(nums, N))
N = 2
print("\nExtract every third element from the said given two dimensional list:")
print(specified_element(nums, N))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now