1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ira Lisetskai [31]
3 years ago
8

Write a test program that prompts the user to enter a two dimensional array and displays the location of the smallest element in

the array.
Computers and Technology
1 answer:
alexandr1967 [171]3 years ago
8 0

Answer:

def element_loc():

   is_end = 'n'

   dimen2 = []

   while is_end == 'n':

       par1 = input("Enter rows and columns: ").split(",")

       part = [int(i) for i in par1]

       dimen2. append(part)

       is_end = input("Do you want to add more rows? y/n: ")

   mini = list()

   for i in dimen2:

       mini. append(min(i))

   result = min(mini)

   row_index = mini. index(result)

   col_index = dimen2[row_index]. index(result)

   print("Row: ", row_index, "Col_index: ", col_index)

element_loc()

Explanation:

The python program solution above prompts users for the two-dimensional array and then the rows of the array are compared with the minimum value stored in another list or array. The row index and the column index are gotten from the mini and dimen2 arrays respectively and are displayed as the position of the minimum value in the two-dimensional array.

You might be interested in
Given a sorted list of integers, output the middle integer. assume the number of integers is always odd.
Svetllana [295]

integer userInput

integer i

integer mid

integer array(20) number

userInput = 1

for i = 0; userInput >= 0; i = i + 1

  if number[i] > -1

     userInput = Get next input

     number[i] = userInput

i = i - 1

mid = i / 2

if i > 9

  Put "Too many inputs" to output

elseif i % 2 == 0

  Put number[mid - 1] to output

else

  Put number[mid] to output

4 0
2 years ago
How many degrees of freedom does any unconstrained object have in 3-D modeling?
Free_Kalibri [48]
I think its 6 degrees

3 0
3 years ago
A draft has the following:<br> Plot<br> Details<br> Transition Words<br> Important events in order
exis [7]
What do you have to do?
7 0
3 years ago
Key Categories: more libraries and thousands of functions
stich3 [128]





b. power
YOUR WELXOME



4 0
3 years ago
Say anything :) teeheeheheheheehhehe
nataly862011 [7]

Answer:

905 shooter slidin on the block he shot at opps no he got can stop running from the cops...

Explanation:

ON GANG PRRRA...

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which organization publishes a handbook that describes various occupations?
    12·1 answer
  • Which term collectively describes hard disks, CDs, and flash drives?
    11·2 answers
  • To achieve balance—that is, to operate an information system that satisfies the user and the security professional—the security
    13·1 answer
  • Eight houses represented as cells are arranged in a straight line java int state []
    14·1 answer
  • . If you have written the following source code:
    9·1 answer
  • The _____ of a local variable is the function in which the variable is created.
    6·1 answer
  • Name all mario kart games in order
    15·2 answers
  • Write a program that:
    13·1 answer
  • Find the unknown quantities
    12·1 answer
  • Write a function called no_you_pick. no_you_pick should have two parameters. The first parameter is a dictionary where the keys
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!